import numpy as np
import pandas as pd
from pandas.api.types import CategoricalDtype
import matplotlib.pyplot as plt
import seaborn as sns
# Thư viện để xử lý các text entry
import fuzzywuzzy
from fuzzywuzzy import process
# Thư viện xây dựng mô hình học máy
from sklearn.model_selection import train_test_split, KFold
from sklearn.preprocessing import StandardScaler, PolynomialFeatures, OneHotEncoder
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error, mean_absolute_error
from xgboost import XGBRegressor
from lightgbm import LGBMRegressor
from catboost import CatBoostRegressor
# Utils
from tqdm import tqdm
import missingno as msno
import optuna
# Thư viện dùng để ẩn các warnings
import warnings
warnings.filterwarnings('ignore')
# Xử lý các giá trị bị sai chính tả
def replace_matches_in_column(df, column, string_to_match, min_ratio):
strings = df[column].unique()
matches = fuzzywuzzy.process.extract(string_to_match, strings,
limit=10, scorer=fuzzywuzzy.fuzz.token_sort_ratio)
# only get matches with a ratio > min_ratio
# matches[1:] because maches[0] alawys = (string_to_match, 100)
close_matches = [matches[0] for matches in matches[1:] if matches[1] >= min_ratio]
# get the rows of all the close matches in our dataframe
rows_with_matches = df[column].isin(close_matches)
for index, row in df[rows_with_matches].iterrows():
print(index, row[column], '->', string_to_match)
# replace all rows with close matches with the input matches
df.loc[rows_with_matches, column] = string_to_match
# Extract index and value from a pandas series
def extract_idx_value(pd_series):
idx = pd_series.index
value = pd_series.values
return idx, value
# Custom Classifier
class Classifier:
def __init__(self, n_fold=5):
self.classifiers = {
'Linear Model': LinearRegression(),
'Decision Tree': DecisionTreeRegressor(random_state=42),
'KNN': KNeighborsRegressor(),
'Random Forest': RandomForestRegressor(random_state=42),
'XGBoost': XGBRegressor(random_state=42, tree_method='gpu_hist', enable_categorical=True),
'LightGBM': LGBMRegressor(random_state=42, device='gpu'),
'CatBoost': CatBoostRegressor(random_state=42, verbose=False, task_type='GPU')
}
self.n_fold = n_fold
self.scores_rmse = {key: 0 for key in self.classifiers.keys()}
self.std_rmse = {key: 0 for key in self.classifiers.keys()}
self.scores_mae = {key: 0 for key in self.classifiers.keys()}
self.std_mae = {key: 0 for key in self.classifiers.keys()}
def fit(self, X, y):
kf = KFold(n_splits=self.n_fold)
for classifier in tqdm(self.classifiers):
scores_rmse = []
scores_mae = []
for train_index, val_index in kf.split(X, y):
X_train, y_train = X.iloc[train_index], y.iloc[train_index]
X_val, y_val = X.iloc[val_index], y.iloc[val_index]
self.classifiers[classifier].fit(X_train, y_train)
y_pred = self.classifiers[classifier].predict(X_val)
scores_rmse.append(mean_squared_error(y_val, y_pred, squared=False))
scores_mae.append(mean_squared_error(y_val, y_pred, squared=True))
self.scores_rmse[classifier] = np.mean(scores_rmse)
self.std_rmse[classifier] = np.std(scores_rmse)
self.scores_mae[classifier] = np.mean(scores_mae)
self.std_mae[classifier] = np.std(scores_mae)
def summary(self):
return pd.DataFrame({
'Score RMSE': self.scores_rmse,
'Std RMSE': self.std_rmse,
'Score MAE': self.scores_mae,
'Std MAE': self.std_mae
})
pd.set_option('display.float_format', lambda x: '%.9f' % x)
pd.set_option('display.max_rows', 500)
DATA_PATH = 'VN_housing_dataset.csv'
# Load dữ liệu và xem vài dòng đầu tiên của data.
df = pd.read_csv(DATA_PATH)
df.head()
| Unnamed: 0 | Ngày | Địa chỉ | Quận | Huyện | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0.000000000 | 2020-08-05 | Đường Hoàng Quốc Việt, Phường Nghĩa Đô, Quận C... | Quận Cầu Giấy | Phường Nghĩa Đô | Nhà ngõ, hẻm | Đã có sổ | 4 | 5 phòng | 46 m² | NaN | NaN | 86,96 triệu/m² |
| 1 | 1.000000000 | 2020-08-05 | Đường Kim Giang, Phường Kim Giang, Quận Thanh ... | Quận Thanh Xuân | Phường Kim Giang | Nhà mặt phố, mặt tiền | NaN | NaN | 3 phòng | 37 m² | NaN | NaN | 116,22 triệu/m² |
| 2 | 2.000000000 | 2020-08-05 | phố minh khai, Phường Minh Khai, Quận Hai Bà T... | Quận Hai Bà Trưng | Phường Minh Khai | Nhà ngõ, hẻm | Đã có sổ | 4 | 4 phòng | 40 m² | 10 m | 4 m | 65 triệu/m² |
| 3 | 3.000000000 | 2020-08-05 | Đường Võng Thị, Phường Thụy Khuê, Quận Tây Hồ,... | Quận Tây Hồ | Phường Thụy Khuê | Nhà ngõ, hẻm | Đã có sổ | NaN | 6 phòng | 51 m² | 12.75 m | 4 m | 100 triệu/m² |
| 4 | 4.000000000 | 2020-08-05 | Đường Kim Giang, Phường Kim Giang, Quận Thanh ... | Quận Thanh Xuân | Phường Kim Giang | Nhà ngõ, hẻm | NaN | NaN | 4 phòng | 36 m² | 9 m | 4 m | 86,11 triệu/m² |
# Xem thông tin của data
df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 82497 entries, 0 to 82496 Data columns (total 13 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Unnamed: 0 82496 non-null float64 1 Ngày 82496 non-null object 2 Địa chỉ 82449 non-null object 3 Quận 82495 non-null object 4 Huyện 82449 non-null object 5 Loại hình nhà ở 82465 non-null object 6 Giấy tờ pháp lý 53610 non-null object 7 Số tầng 36399 non-null object 8 Số phòng ngủ 82458 non-null object 9 Diện tích 82495 non-null object 10 Dài 19827 non-null object 11 Rộng 35445 non-null object 12 Giá/m2 82484 non-null object dtypes: float64(1), object(12) memory usage: 8.2+ MB
# Drop các dòng bị trùng
df.drop_duplicates(inplace=True)
# Drop các dòng missing toàn bộ
df.dropna(axis=0, how='all', inplace=True)
# Drop các dòng bị missing 'Giá/m2'
df.dropna(axis=0, subset=['Giá/m2'], inplace=True)
# Drop cột Unnamed: 0
df.drop(['Unnamed: 0'], axis=1, inplace=True)
# Đổi tên cột 'Huyện' thành 'Phường'
df.rename(columns={'Huyện': 'Phường'}, inplace=True)
# Reset index
df.reset_index(drop=True, inplace=True)
# Số lượng các giá trị bị thiếu trong mỗi cột
df.isna().sum()
Ngày 0 Địa chỉ 47 Quận 1 Phường 47 Loại hình nhà ở 31 Giấy tờ pháp lý 28882 Số tầng 46089 Số phòng ngủ 38 Diện tích 0 Dài 62661 Rộng 47045 Giá/m2 0 dtype: int64
msno.matrix(df, figsize = (30,10))
plt.title('Missing value in dataset')
plt.show()
# Tỉ lệ giá trị NaN trong mỗi cột
ratio_nan_per_col = df.isna().sum() / len(df) * 100
ratio_nan_per_col
Ngày 0.000000000 Địa chỉ 0.056980748 Quận 0.001212356 Phường 0.056980748 Loại hình nhà ở 0.037583046 Giấy tờ pháp lý 35.015275690 Số tầng 55.876291159 Số phòng ngủ 0.046069541 Diện tích 0.000000000 Dài 75.967460356 Rộng 57.035303816 Giá/m2 0.000000000 dtype: float64
# Các dòng dữ liệu bị missing ở cột 'Quận'
df[df['Quận'].isna()]
| Ngày | Địa chỉ | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 48416 | 2020-07-03 | 68, Ngọc Hồi, Hà Nội | NaN | NaN | Nhà ngõ, hẻm | Đã có sổ | NaN | 2 phòng | 71 m² | 6 m | 6 m | 43 triệu/m² |
68 Ngọc Hồi thuộc Phường Hoàng Liệt, Quận Hoàng Mai
df.loc[df[df['Quận'].isna()].index, ['Quận', 'Phường']] = ['Quận Hoàng Mai', 'Phường Hoàng Liệt']
# Các dòng dữ liệu bị missing ở cột 'Phường'
df[df['Phường'].isna()]
| Ngày | Địa chỉ | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 174 | 2020-08-04 | NaN | Quận Nam Từ Liêm | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 30 m² | NaN | NaN | 1 đ/m² |
| 324 | 2020-08-04 | Đường An Dương Vương, Quận Tây Hồ, Hà Nội | Quận Tây Hồ | NaN | Nhà ngõ, hẻm | Đã có sổ | 4 | 4 phòng | 77 m² | 11 m | 7 m | 97,4 triệu/m² |
| 741 | 2020-08-04 | Cầu Khê Tang, Quận Hà Đông, Hà Nội | Quận Hà Đông | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 36 m² | NaN | NaN | 43,06 triệu/m² |
| 4558 | 2020-08-03 | NaN | Huyện Hoài Đức | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 30 m² | NaN | NaN | 16,67 triệu/m² |
| 5282 | 2020-08-02 | NaN | Quận Long Biên | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 35 m² | NaN | NaN | 2 đ/m² |
| 5295 | 2020-08-02 | NaN | Quận Long Biên | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 35 m² | NaN | NaN | 2,14 triệu/m² |
| 7169 | 2020-08-01 | NaN | Huyện Thanh Trì | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 50 m² | NaN | NaN | 60 triệu/m² |
| 8583 | 2020-07-31 | NaN | Quận Thanh Xuân | NaN | Nhà ngõ, hẻm | Đã có sổ | 5 | 4 phòng | 33 m² | NaN | 4.1 m | 90,91 triệu/m² |
| 12594 | 2020-07-29 | NaN | Quận Hà Đông | NaN | Nhà ngõ, hẻm | NaN | NaN | 2 phòng | 40 m² | NaN | NaN | 27,5 triệu/m² |
| 14547 | 2020-07-28 | NaN | Quận Hà Đông | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 40 m² | NaN | NaN | 25 triệu/m² |
| 15054 | 2020-07-28 | NaN | Quận Hoàng Mai | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 2 phòng | 45 m² | NaN | NaN | 2,22 triệu/m² |
| 21213 | 2020-07-23 | NaN | Quận Bắc Từ Liêm | NaN | Nhà ngõ, hẻm | NaN | NaN | 2 phòng | 30 m² | NaN | NaN | 33,33 triệu/m² |
| 23167 | 2020-07-22 | NaN | Quận Hoàng Mai | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 3 phòng | 40 m² | NaN | NaN | 1.250 đ/m² |
| 27281 | 2020-07-20 | NaN | Quận Hoàng Mai | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 51 m² | NaN | NaN | 52,94 triệu/m² |
| 27348 | 2020-07-20 | NaN | Huyện Đông Anh | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 20 m² | NaN | NaN | 20 triệu/m² |
| 29299 | 2020-07-18 | Đường Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | Đã có sổ | 4 | 3 phòng | 24 m² | NaN | NaN | 129,17 triệu/m² |
| 32880 | 2020-07-15 | NaN | Quận Ba Đình | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 30 m² | NaN | NaN | 66,67 triệu/m² |
| 35552 | 2020-07-14 | Đường Thịnh Hào 3, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | Đã có sổ | NaN | 6 phòng | 36 m² | NaN | NaN | 100 triệu/m² |
| 40592 | 2020-07-09 | NaN | Quận Bắc Từ Liêm | NaN | Nhà ngõ, hẻm | NaN | NaN | 2 phòng | 40 m² | NaN | NaN | 12 đ/m² |
| 40905 | 2020-07-09 | Đường Kim Giang, Quận Thanh Xuân, Hà Nội | Quận Thanh Xuân | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 82,5 triệu/m² |
| 41191 | 2020-07-09 | NaN | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 35 m² | NaN | NaN | 200.000 đ/m² |
| 44260 | 2020-07-07 | NaN | Quận Long Biên | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 30 m² | NaN | NaN | 33,33 triệu/m² |
| 46174 | 2020-07-06 | Đường Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | NaN | NaN | 4 phòng | 50 m² | NaN | NaN | 80 triệu/m² |
| 46763 | 2020-07-05 | NaN | Quận Hà Đông | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 45 m² | NaN | NaN | 31,11 triệu/m² |
| 49336 | 2020-07-03 | NaN | Quận Hoàng Mai | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 3 phòng | 30 m² | NaN | NaN | 60.000 đ/m² |
| 52183 | 2020-07-01 | Trung Kính - Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | NaN | NaN | NaN | 3 phòng | 36 m² | NaN | NaN | 80,56 triệu/m² |
| 54423 | 2020-06-29 | Đường Trần Duy Hưng, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | Đã có sổ | 5 | 4 phòng | 40 m² | NaN | NaN | 140 triệu/m² |
| 54855 | 2020-06-28 | NaN | Quận Hà Đông | NaN | Nhà biệt thự | NaN | NaN | 2 phòng | 50 m² | NaN | NaN | 1 đ/m² |
| 55083 | 2020-06-28 | NaN | Quận Long Biên | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 35 m² | NaN | NaN | 37,14 triệu/m² |
| 58637 | 2020-06-25 | Đường Bùi Xương Trạch, Quận Thanh Xuân, Hà Nội | Quận Thanh Xuân | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 31 m² | NaN | NaN | 116,13 triệu/m² |
| 61774 | 2020-06-23 | Đường Tôn Thất Tùng, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 37 m² | NaN | NaN | 110,81 triệu/m² |
| 62052 | 2020-06-22 | Đường Hồ Tùng Mậu||821, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | Đã có sổ | 5 | 4 phòng | 33 m² | 10 m | 4 m | 96,97 triệu/m² |
| 65306 | 2020-06-19 | NaN | Quận Hà Đông | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 4 phòng | 50 m² | NaN | NaN | 40 triệu/m² |
| 69467 | 2020-06-17 | Đường Hào Nam, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | Đã có sổ | NaN | 3 phòng | 35 m² | NaN | NaN | 91,43 triệu/m² |
| 70511 | 2020-06-16 | Đường Ngọc Lâm, Quận Ba Đình, Hà Nội | Quận Ba Đình | NaN | Nhà mặt phố, mặt tiền | Đã có sổ | NaN | 4 phòng | 51 m² | NaN | NaN | 94,12 triệu/m² |
| 72244 | 2020-06-15 | NaN | Quận Nam Từ Liêm | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 20 m² | NaN | NaN | 25 triệu/m² |
| 72721 | 2020-06-14 | 665, Đường Tân Mai, Quận Hoàng Mai, Hà Nội | Quận Hoàng Mai | NaN | Nhà ngõ, hẻm | NaN | NaN | 6 phòng | 45 m² | NaN | NaN | 74,44 triệu/m² |
| 73912 | 2020-06-12 | Đường Lạc Long Quân, Quận Tây Hồ, Hà Nội | Quận Tây Hồ | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 1 phòng | 200 m² | NaN | NaN | 128 triệu/m² |
| 75807 | 2020-06-11 | Hà Đông , Hà Nội, Quận Hà Đông, Hà Nội | Quận Hà Đông | NaN | NaN | NaN | NaN | 4 phòng | 47 m² | NaN | NaN | 82,77 triệu/m² |
| 75812 | 2020-06-11 | NaN | Quận Ba Đình | NaN | Nhà ngõ, hẻm | NaN | NaN | 1 phòng | 35 m² | NaN | NaN | 17,14 triệu/m² |
| 76659 | 2020-06-10 | NaN | Quận Ba Đình | NaN | Nhà ngõ, hẻm | NaN | NaN | 2 phòng | 30 m² | NaN | NaN | 28,33 triệu/m² |
| 78768 | 2020-06-09 | Đường Hoàng Mai, Quận Hoàng Mai, Hà Nội | Quận Hoàng Mai | NaN | Nhà ngõ, hẻm | NaN | NaN | 5 phòng | 48 m² | NaN | NaN | 76,04 triệu/m² |
| 79348 | 2020-06-08 | Trần Duy Hưng - Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 92,5 triệu/m² |
| 79985 | 2020-06-08 | Đường Hoàng Văn Thái, Quận Thanh Xuân, Hà Nội | Quận Thanh Xuân | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 4 phòng | 45 m² | NaN | NaN | 116,67 triệu/m² |
| 80906 | 2020-06-07 | NaN | Quận Hoàng Mai | NaN | Nhà ngõ, hẻm | NaN | NaN | 2 phòng | 30 m² | NaN | NaN | 36,67 triệu/m² |
| 81021 | 2020-06-07 | Đường Chợ Khâm Thiên, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | Đã có sổ | 3 | 3 phòng | 42 m² | NaN | 45 m | 58,33 triệu/m² |
df['Địa chỉ']
0 Đường Hoàng Quốc Việt, Phường Nghĩa Đô, Quận C...
1 Đường Kim Giang, Phường Kim Giang, Quận Thanh ...
2 phố minh khai, Phường Minh Khai, Quận Hai Bà T...
3 Đường Võng Thị, Phường Thụy Khuê, Quận Tây Hồ,...
4 Đường Kim Giang, Phường Kim Giang, Quận Thanh ...
...
82479 Đường Hồ Tùng Mậu, Phường Phúc Diễn, Quận Bắc ...
82480 Đường Trần Quốc Hoàn, Phường Quan Hoa, Quận Cầ...
82481 Đường Nguyễn Khánh Toàn, Phường Quan Hoa, Quận...
82482 Đường Quan Hoa, Phường Quan Hoa, Quận Cầu Giấy...
82483 Đường Hồ Tùng Mậu, Phường Mai Dịch, Quận Cầu G...
Name: Địa chỉ, Length: 82484, dtype: object
# Vì ta điền giữ liệu cột Huyện dựa vào cột Địa chỉ nên ta sẽ chỉ chọn các dòng dữ liệu có cột Địa chỉ không bị missing
df[df['Phường'].isna() & ~df['Địa chỉ'].isna()]
| Ngày | Địa chỉ | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 324 | 2020-08-04 | Đường An Dương Vương, Quận Tây Hồ, Hà Nội | Quận Tây Hồ | NaN | Nhà ngõ, hẻm | Đã có sổ | 4 | 4 phòng | 77 m² | 11 m | 7 m | 97,4 triệu/m² |
| 741 | 2020-08-04 | Cầu Khê Tang, Quận Hà Đông, Hà Nội | Quận Hà Đông | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 36 m² | NaN | NaN | 43,06 triệu/m² |
| 29299 | 2020-07-18 | Đường Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | Đã có sổ | 4 | 3 phòng | 24 m² | NaN | NaN | 129,17 triệu/m² |
| 35552 | 2020-07-14 | Đường Thịnh Hào 3, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | Đã có sổ | NaN | 6 phòng | 36 m² | NaN | NaN | 100 triệu/m² |
| 40905 | 2020-07-09 | Đường Kim Giang, Quận Thanh Xuân, Hà Nội | Quận Thanh Xuân | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 82,5 triệu/m² |
| 46174 | 2020-07-06 | Đường Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | NaN | NaN | 4 phòng | 50 m² | NaN | NaN | 80 triệu/m² |
| 52183 | 2020-07-01 | Trung Kính - Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | NaN | NaN | NaN | 3 phòng | 36 m² | NaN | NaN | 80,56 triệu/m² |
| 54423 | 2020-06-29 | Đường Trần Duy Hưng, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | Đã có sổ | 5 | 4 phòng | 40 m² | NaN | NaN | 140 triệu/m² |
| 58637 | 2020-06-25 | Đường Bùi Xương Trạch, Quận Thanh Xuân, Hà Nội | Quận Thanh Xuân | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 31 m² | NaN | NaN | 116,13 triệu/m² |
| 61774 | 2020-06-23 | Đường Tôn Thất Tùng, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 37 m² | NaN | NaN | 110,81 triệu/m² |
| 62052 | 2020-06-22 | Đường Hồ Tùng Mậu||821, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | Nhà ngõ, hẻm | Đã có sổ | 5 | 4 phòng | 33 m² | 10 m | 4 m | 96,97 triệu/m² |
| 69467 | 2020-06-17 | Đường Hào Nam, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | Đã có sổ | NaN | 3 phòng | 35 m² | NaN | NaN | 91,43 triệu/m² |
| 70511 | 2020-06-16 | Đường Ngọc Lâm, Quận Ba Đình, Hà Nội | Quận Ba Đình | NaN | Nhà mặt phố, mặt tiền | Đã có sổ | NaN | 4 phòng | 51 m² | NaN | NaN | 94,12 triệu/m² |
| 72721 | 2020-06-14 | 665, Đường Tân Mai, Quận Hoàng Mai, Hà Nội | Quận Hoàng Mai | NaN | Nhà ngõ, hẻm | NaN | NaN | 6 phòng | 45 m² | NaN | NaN | 74,44 triệu/m² |
| 73912 | 2020-06-12 | Đường Lạc Long Quân, Quận Tây Hồ, Hà Nội | Quận Tây Hồ | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 1 phòng | 200 m² | NaN | NaN | 128 triệu/m² |
| 75807 | 2020-06-11 | Hà Đông , Hà Nội, Quận Hà Đông, Hà Nội | Quận Hà Đông | NaN | NaN | NaN | NaN | 4 phòng | 47 m² | NaN | NaN | 82,77 triệu/m² |
| 78768 | 2020-06-09 | Đường Hoàng Mai, Quận Hoàng Mai, Hà Nội | Quận Hoàng Mai | NaN | Nhà ngõ, hẻm | NaN | NaN | 5 phòng | 48 m² | NaN | NaN | 76,04 triệu/m² |
| 79348 | 2020-06-08 | Trần Duy Hưng - Cầu Giấy, Quận Cầu Giấy, Hà Nội | Quận Cầu Giấy | NaN | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 92,5 triệu/m² |
| 79985 | 2020-06-08 | Đường Hoàng Văn Thái, Quận Thanh Xuân, Hà Nội | Quận Thanh Xuân | NaN | Nhà mặt phố, mặt tiền | NaN | NaN | 4 phòng | 45 m² | NaN | NaN | 116,67 triệu/m² |
| 81021 | 2020-06-07 | Đường Chợ Khâm Thiên, Quận Đống Đa, Hà Nội | Quận Đống Đa | NaN | Nhà ngõ, hẻm | Đã có sổ | 3 | 3 phòng | 42 m² | NaN | 45 m | 58,33 triệu/m² |
Do khó xác định chính xác địa chỉ nên ta sẽ điền giá trị Phường bị missing với giá trị mode phường theo Quận
# Tại index 72730, có địa chỉ 665, Đường Tân Mai, Quận Hoàng Mai, Hà Nội => Phường Hoàng Văn Thụ, Quận Hoàng Mai, Hà Nội
df.loc[72730, 'Phường'] = 'Phường Hoàng Văn Thụ'
# Một số Quận có mode là 2 phường, do đó ta sẽ lấy phường đầu tiên làm mode
df_mode_phuong = df.groupby('Quận')['Phường'].agg(
{ lambda x: x.mode()[0] }
)
df_mode_phuong.head()
| <lambda> | |
|---|---|
| Quận | |
| Huyện Ba Vì | Xã Vân Hòa |
| Huyện Chương Mỹ | Thị trấn Xuân Mai |
| Huyện Gia Lâm | Thị trấn Trâu Quỳ |
| Huyện Hoài Đức | Xã Vân Canh |
| Huyện Mê Linh | Thị trấn Quang Minh |
for index, row in df[df['Phường'].isna()].iterrows():
df.loc[index, 'Phường'] = df_mode_phuong.loc[row['Quận']][0]
# Do ta đã có cột 'Quận', 'Phường', do vậy ta có thể drop cột 'Địa chỉ'
df.drop(['Địa chỉ'], axis=1, inplace=True)
df[df['Loại hình nhà ở'].isna()]
| Ngày | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 3928 | 2020-08-03 | Quận Tây Hồ | Phường Quảng An | NaN | NaN | NaN | NaN | 1000 m² | NaN | NaN | 12,6 triệu/m² |
| 19887 | 2020-07-24 | Quận Hà Đông | Phường Phúc La | NaN | Đã có sổ | NaN | 4 phòng | 50 m² | NaN | NaN | 136 triệu/m² |
| 23414 | 2020-07-22 | Quận Tây Hồ | Phường Xuân La | NaN | Đã có sổ | NaN | NaN | 33 m² | 9 m | 3.6 m | 93,94 triệu/m² |
| 26556 | 2020-07-20 | Quận Đống Đa | Phường Láng Hạ | NaN | Đã có sổ | NaN | NaN | 71 m² | NaN | NaN | 185,92 triệu/m² |
| 26907 | 2020-07-20 | Quận Nam Từ Liêm | Phường Đại Mỗ | NaN | Đang chờ sổ | NaN | 1 phòng | 45 m² | NaN | NaN | 488.888 đ/m² |
| 27057 | 2020-07-20 | Quận Đống Đa | Phường Ô Chợ Dừa | NaN | Đã có sổ | NaN | NaN | 47 m² | NaN | NaN | 276,6 triệu/m² |
| 29869 | 2020-07-17 | Quận Đống Đa | Phường Ô Chợ Dừa | NaN | Đã có sổ | NaN | NaN | 70 m² | NaN | NaN | 428,57 triệu/m² |
| 34666 | 2020-07-14 | Quận Hà Đông | Phường Hà Cầu | NaN | NaN | NaN | 3 phòng | 36 m² | NaN | NaN | 76,39 triệu/m² |
| 34995 | 2020-07-14 | Quận Hà Đông | Phường La Khê | NaN | NaN | NaN | 4 phòng | 50 m² | NaN | NaN | 87,6 triệu/m² |
| 47740 | 2020-07-04 | Quận Nam Từ Liêm | Phường Mỹ Đình 2 | NaN | NaN | NaN | 2 phòng | 40 m² | NaN | NaN | 66,25 triệu/m² |
| 51995 | 2020-07-01 | Thị xã Sơn Tây | Xã Cổ Đông | NaN | Đang chờ sổ | NaN | NaN | 117 m² | 24 m | 5 m | 13,68 triệu/m² |
| 52183 | 2020-07-01 | Quận Cầu Giấy | Phường Yên Hoà | NaN | NaN | NaN | 3 phòng | 36 m² | NaN | NaN | 80,56 triệu/m² |
| 53542 | 2020-06-29 | Quận Long Biên | Phường Bồ Đề | NaN | Đã có sổ | NaN | NaN | 50 m² | NaN | NaN | 130 triệu/m² |
| 53799 | 2020-06-29 | Quận Hà Đông | Phường Hà Cầu | NaN | NaN | NaN | 4 phòng | 38 m² | NaN | NaN | 70,53 triệu/m² |
| 56568 | 2020-06-26 | Quận Hà Đông | Phường Văn Quán | NaN | Đã có sổ | NaN | NaN | 40 m² | NaN | NaN | 96,25 triệu/m² |
| 57999 | 2020-06-25 | Quận Hà Đông | Phường Hà Cầu | NaN | NaN | NaN | 3 phòng | 38 m² | NaN | NaN | 69.736,842105263 tỷ/m² |
| 58364 | 2020-06-25 | Quận Thanh Xuân | Phường Thanh Xuân Nam | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 42,5 triệu/m² |
| 58415 | 2020-06-25 | Quận Ba Đình | Phường Ngọc Khánh | NaN | Đã có sổ | NaN | NaN | 120 m² | NaN | NaN | 48,33 triệu/m² |
| 61541 | 2020-06-23 | Quận Hoàng Mai | Phường Đại Kim | NaN | Đã có sổ | NaN | 5 phòng | 75 m² | NaN | NaN | 233,33 triệu/m² |
| 61948 | 2020-06-23 | Quận Hà Đông | Phường Phúc La | NaN | Đã có sổ | NaN | 4 phòng | 140 m² | NaN | NaN | 11,43 triệu/m² |
| 62031 | 2020-06-22 | Quận Hà Đông | Phường Kiến Hưng | NaN | NaN | NaN | 3 phòng | 37 m² | NaN | NaN | 62,16 triệu/m² |
| 62040 | 2020-06-22 | Quận Hà Đông | Phường Văn Quán | NaN | NaN | NaN | 3 phòng | 37 m² | NaN | NaN | 83,24 triệu/m² |
| 62398 | 2020-06-22 | Huyện Hoài Đức | Xã Di Trạch | NaN | Giấy tờ khác | NaN | NaN | 93 m² | 20 m | 5 m | 50,54 triệu/m² |
| 66969 | 2020-06-18 | Quận Cầu Giấy | Phường Quan Hoa | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 90 triệu/m² |
| 69960 | 2020-06-16 | Quận Hà Đông | Phường Dương Nội | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 52,5 triệu/m² |
| 75735 | 2020-06-11 | Quận Cầu Giấy | Phường Dịch Vọng | NaN | NaN | NaN | 3 phòng | 40 m² | NaN | NaN | 102,5 triệu/m² |
| 75807 | 2020-06-11 | Quận Hà Đông | Phường Văn Quán | NaN | NaN | NaN | 4 phòng | 47 m² | NaN | NaN | 82,77 triệu/m² |
| 76382 | 2020-06-10 | Quận Hà Đông | Phường Dương Nội | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 55 triệu/m² |
| 79334 | 2020-06-08 | Quận Cầu Giấy | Phường Nghĩa Đô | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 177,5 triệu/m² |
| 79348 | 2020-06-08 | Quận Cầu Giấy | Phường Yên Hoà | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 92,5 triệu/m² |
| 79889 | 2020-06-08 | Quận Cầu Giấy | Phường Nghĩa Tân | NaN | NaN | NaN | 4 phòng | 40 m² | NaN | NaN | 175 triệu/m² |
df['Loại hình nhà ở'].value_counts()
Loại hình nhà ở Nhà ngõ, hẻm 62528 Nhà mặt phố, mặt tiền 17092 Nhà phố liền kề 1881 Nhà biệt thự 952 Name: count, dtype: int64
Điền giá trị NaN bằng giá trị mode
df['Loại hình nhà ở'].fillna('Nhà ngõ, hẻm', inplace=True)
df['Giấy tờ pháp lý'].value_counts()
Giấy tờ pháp lý Đã có sổ 52906 Đang chờ sổ 356 Giấy tờ khác 340 Name: count, dtype: int64
df[df['Giấy tờ pháp lý'].isna()]
| Ngày | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2020-08-05 | Quận Thanh Xuân | Phường Kim Giang | Nhà mặt phố, mặt tiền | NaN | NaN | 3 phòng | 37 m² | NaN | NaN | 116,22 triệu/m² |
| 4 | 2020-08-05 | Quận Thanh Xuân | Phường Kim Giang | Nhà ngõ, hẻm | NaN | NaN | 4 phòng | 36 m² | 9 m | 4 m | 86,11 triệu/m² |
| 6 | 2020-08-05 | Quận Đống Đa | Phường Trung Liệt | Nhà ngõ, hẻm | NaN | NaN | 3 phòng | 52 m² | NaN | 4.5 m | 112,5 triệu/m² |
| 8 | 2020-08-05 | Quận Tây Hồ | Phường Xuân La | Nhà ngõ, hẻm | NaN | NaN | 4 phòng | 75 m² | 12 m | 6.5 m | 120 triệu/m² |
| 13 | 2020-08-05 | Quận Hà Đông | Phường Quang Trung | Nhà ngõ, hẻm | NaN | NaN | 5 phòng | 50 m² | NaN | 5 m | 86 triệu/m² |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 82474 | 2019-10-15 | Quận Nam Từ Liêm | Phường Mỹ Đình 2 | Nhà mặt phố, mặt tiền | NaN | NaN | 4 phòng | 50 m² | NaN | NaN | 106 triệu/m² |
| 82475 | 2019-10-15 | Quận Nam Từ Liêm | Phường Mỹ Đình 1 | Nhà ngõ, hẻm | NaN | NaN | 6 phòng | 60 m² | NaN | NaN | 91,67 triệu/m² |
| 82479 | 2019-08-23 | Quận Bắc Từ Liêm | Phường Phúc Diễn | Nhà phố liền kề | NaN | NaN | 3 phòng | 38 m² | NaN | NaN | 81,58 triệu/m² |
| 82480 | 2019-08-07 | Quận Cầu Giấy | Phường Quan Hoa | Nhà mặt phố, mặt tiền | NaN | NaN | 3 phòng | 50 m² | NaN | NaN | 292 triệu/m² |
| 82483 | 2019-08-05 | Quận Cầu Giấy | Phường Mai Dịch | Nhà phố liền kề | NaN | NaN | 4 phòng | 45 m² | NaN | NaN | 102,22 triệu/m² |
28882 rows × 11 columns
# Do số lượng dòng bị missing ở cột 'Giấy tờ pháp lý' lớn, do đó ta sẽ thay thế các giá trị bị missing bằng 'Unknown'
df['Giấy tờ pháp lý'].fillna('Unknown', inplace=True)
df['Số tầng'].value_counts()
Số tầng 5 15767 4 12277 3 3619 6 2119 2 1028 1 636 7 597 8 188 9 88 10 36 45 8 Nhiều hơn 10 7 35 6 50 2 12 2 38 2 30 1 32 1 54 1 52 1 40 1 14 1 65 1 55 1 73 1 25 1 42 1 33 1 29 1 Name: count, dtype: int64
df[df['Số tầng'].isna()]
| Ngày | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2020-08-05 | Quận Thanh Xuân | Phường Kim Giang | Nhà mặt phố, mặt tiền | Unknown | NaN | 3 phòng | 37 m² | NaN | NaN | 116,22 triệu/m² |
| 3 | 2020-08-05 | Quận Tây Hồ | Phường Thụy Khuê | Nhà ngõ, hẻm | Đã có sổ | NaN | 6 phòng | 51 m² | 12.75 m | 4 m | 100 triệu/m² |
| 4 | 2020-08-05 | Quận Thanh Xuân | Phường Kim Giang | Nhà ngõ, hẻm | Unknown | NaN | 4 phòng | 36 m² | 9 m | 4 m | 86,11 triệu/m² |
| 5 | 2020-08-05 | Quận Cầu Giấy | Phường Yên Hoà | Nhà ngõ, hẻm | Đã có sổ | NaN | nhiều hơn 10 phòng | 46 m² | 12.1 m | 3.8 m | 104,35 triệu/m² |
| 6 | 2020-08-05 | Quận Đống Đa | Phường Trung Liệt | Nhà ngõ, hẻm | Unknown | NaN | 3 phòng | 52 m² | NaN | 4.5 m | 112,5 triệu/m² |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 82479 | 2019-08-23 | Quận Bắc Từ Liêm | Phường Phúc Diễn | Nhà phố liền kề | Unknown | NaN | 3 phòng | 38 m² | NaN | NaN | 81,58 triệu/m² |
| 82480 | 2019-08-07 | Quận Cầu Giấy | Phường Quan Hoa | Nhà mặt phố, mặt tiền | Unknown | NaN | 3 phòng | 50 m² | NaN | NaN | 292 triệu/m² |
| 82481 | 2019-08-07 | Quận Cầu Giấy | Phường Quan Hoa | Nhà mặt phố, mặt tiền | Đã có sổ | NaN | 4 phòng | 41 m² | NaN | NaN | 341,46 triệu/m² |
| 82482 | 2019-08-05 | Quận Cầu Giấy | Phường Quan Hoa | Nhà ngõ, hẻm | Đã có sổ | NaN | 4 phòng | 60 m² | NaN | NaN | 101,67 triệu/m² |
| 82483 | 2019-08-05 | Quận Cầu Giấy | Phường Mai Dịch | Nhà phố liền kề | Unknown | NaN | 4 phòng | 45 m² | NaN | NaN | 102,22 triệu/m² |
46089 rows × 11 columns
# Do số lượng dòng bị missing ở cột 'Số tầng' lớn, do đó ta sẽ thay thế các giá trị bị missing bằng 'Unknown'
df['Số tầng'].fillna('Unknown', inplace=True)
df['Số phòng ngủ'].value_counts()
Số phòng ngủ 4 phòng 29068 3 phòng 27156 5 phòng 7923 2 phòng 7329 6 phòng 6461 1 phòng 1388 8 phòng 938 nhiều hơn 10 phòng 868 7 phòng 678 10 phòng 354 9 phòng 283 Name: count, dtype: int64
df[df['Số phòng ngủ'].isna()]
| Ngày | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Dài | Rộng | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 3928 | 2020-08-03 | Quận Tây Hồ | Phường Quảng An | Nhà ngõ, hẻm | Unknown | Unknown | NaN | 1000 m² | NaN | NaN | 12,6 triệu/m² |
| 5478 | 2020-08-02 | Quận Long Biên | Phường Việt Hưng | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 60 m² | 15 m | 4 m | 99,17 triệu/m² |
| 13982 | 2020-07-28 | Quận Bắc Từ Liêm | Phường Xuân Đỉnh | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 100 m² | NaN | 6.5 m | 42 triệu/m² |
| 21173 | 2020-07-23 | Quận Đống Đa | Phường Phương Mai | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 49 m² | NaN | NaN | 146,94 triệu/m² |
| 23414 | 2020-07-22 | Quận Tây Hồ | Phường Xuân La | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 33 m² | 9 m | 3.6 m | 93,94 triệu/m² |
| 26285 | 2020-07-20 | Quận Hoàng Mai | Phường Vĩnh Hưng | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 72 m² | 20 m | 4 m | 100 triệu/m² |
| 26556 | 2020-07-20 | Quận Đống Đa | Phường Láng Hạ | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 71 m² | NaN | NaN | 185,92 triệu/m² |
| 26725 | 2020-07-20 | Quận Thanh Xuân | Phường Khương Mai | Nhà ngõ, hẻm | Đang chờ sổ | Unknown | NaN | 32 m² | NaN | NaN | 61,88 triệu/m² |
| 27057 | 2020-07-20 | Quận Đống Đa | Phường Ô Chợ Dừa | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 47 m² | NaN | NaN | 276,6 triệu/m² |
| 28833 | 2020-07-18 | Quận Bắc Từ Liêm | Phường Cổ Nhuế 1 | Nhà mặt phố, mặt tiền | Unknown | Unknown | NaN | 54 m² | NaN | NaN | 37,04 triệu/m² |
| 29440 | 2020-07-18 | Quận Đống Đa | Phường Ngã Tư Sở | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 77 m² | NaN | NaN | 57,79 triệu/m² |
| 29869 | 2020-07-17 | Quận Đống Đa | Phường Ô Chợ Dừa | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 70 m² | NaN | NaN | 428,57 triệu/m² |
| 30915 | 2020-07-17 | Quận Bắc Từ Liêm | Phường Xuân Đỉnh | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 32 m² | 10 m | 3 m | 79,69 triệu/m² |
| 32898 | 2020-07-15 | Quận Cầu Giấy | Phường Nghĩa Đô | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 55 m² | NaN | NaN | 63,64 triệu/m² |
| 33090 | 2020-07-15 | Huyện Đan Phượng | Thị trấn Phùng | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 56 m² | 14 m | 4 m | 49,61 triệu/m² |
| 33502 | 2020-07-15 | Quận Thanh Xuân | Phường Khương Trung | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 25 m² | NaN | NaN | 240 triệu/m² |
| 34387 | 2020-07-14 | Quận Hoàng Mai | Phường Hoàng Văn Thụ | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 80 m² | 100 m | 78 m | 75 triệu/m² |
| 38235 | 2020-07-11 | Huyện Thanh Trì | Xã Tả Thanh Oai | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 39 m² | NaN | NaN | 25,38 triệu/m² |
| 40936 | 2020-07-09 | Quận Đống Đa | Phường Láng Thượng | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 38 m² | NaN | NaN | 171,05 triệu/m² |
| 44435 | 2020-07-07 | Quận Nam Từ Liêm | Phường Mỹ Đình 1 | Nhà mặt phố, mặt tiền | Unknown | Unknown | NaN | 100 m² | 20 m | 5 m | 170 triệu/m² |
| 45361 | 2020-07-06 | Quận Long Biên | Phường Long Biên | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 65 m² | NaN | NaN | 229,23 triệu/m² |
| 49996 | 2020-07-02 | Quận Hoàng Mai | Phường Yên Sở | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 33 m² | 9 m | 4 m | 60,61 triệu/m² |
| 51209 | 2020-07-01 | Quận Cầu Giấy | Phường Dịch Vọng Hậu | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 32 m² | 9 m | 4 m | 78,13 triệu/m² |
| 51692 | 2020-07-01 | Quận Hai Bà Trưng | Phường Thanh Nhàn | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 204 m² | NaN | 5 m | 132,35 triệu/m² |
| 51995 | 2020-07-01 | Thị xã Sơn Tây | Xã Cổ Đông | Nhà ngõ, hẻm | Đang chờ sổ | Unknown | NaN | 117 m² | 24 m | 5 m | 13,68 triệu/m² |
| 53542 | 2020-06-29 | Quận Long Biên | Phường Bồ Đề | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 50 m² | NaN | NaN | 130 triệu/m² |
| 55874 | 2020-06-27 | Quận Nam Từ Liêm | Phường Xuân Phương | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 41 m² | 8 m | 5 m | 74,39 triệu/m² |
| 55972 | 2020-06-27 | Huyện Quốc Oai | Xã Phú Cát | Nhà biệt thự | Đã có sổ | Unknown | NaN | 2400 m² | NaN | NaN | 6,67 triệu/m² |
| 56260 | 2020-06-27 | Quận Nam Từ Liêm | Phường Mỹ Đình 1 | Nhà mặt phố, mặt tiền | Unknown | Unknown | NaN | 38 m² | NaN | NaN | 89,47 triệu/m² |
| 56568 | 2020-06-26 | Quận Hà Đông | Phường Văn Quán | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 40 m² | NaN | NaN | 96,25 triệu/m² |
| 56864 | 2020-06-26 | Quận Ba Đình | Phường Ngọc Khánh | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 106 m² | NaN | 106 m | 174,53 triệu/m² |
| 58415 | 2020-06-25 | Quận Ba Đình | Phường Ngọc Khánh | Nhà ngõ, hẻm | Đã có sổ | Unknown | NaN | 120 m² | NaN | NaN | 48,33 triệu/m² |
| 59545 | 2020-06-24 | Quận Đống Đa | Phường Ngã Tư Sở | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 100 m² | NaN | NaN | 230 triệu/m² |
| 62398 | 2020-06-22 | Huyện Hoài Đức | Xã Di Trạch | Nhà ngõ, hẻm | Giấy tờ khác | Unknown | NaN | 93 m² | 20 m | 5 m | 50,54 triệu/m² |
| 64360 | 2020-06-20 | Quận Hoàng Mai | Phường Giáp Bát | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 48 m² | 12 m | 3 m | 72,92 triệu/m² |
| 71638 | 2020-06-15 | Quận Nam Từ Liêm | Phường Phú Đô | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 38 m² | NaN | NaN | 67,11 triệu/m² |
| 72203 | 2020-06-15 | Quận Hoàng Mai | Phường Lĩnh Nam | Nhà mặt phố, mặt tiền | Đã có sổ | Unknown | NaN | 75 m² | NaN | NaN | 74,67 triệu/m² |
| 72428 | 2020-06-14 | Quận Hoàng Mai | Phường Tân Mai | Nhà ngõ, hẻm | Unknown | Unknown | NaN | 50 m² | NaN | NaN | 110 triệu/m² |
# Do số lượng dòng bị missing ở cột 'Số phòng ngủ' nhỏ, nên ta điền các giá trị bị missing bằng mode
df['Số phòng ngủ'].fillna('4 phòng', inplace=True)
Do đã có cột 'Diện tích', nên cột 'Dài', 'Rộng' không cần thiết
df.drop(['Dài', 'Rộng'], axis=1, inplace=True)
Dữ liệu đã xử lý xong missing data
print('Số lượng missing data trong mỗi cột:')
df.isna().sum()
Số lượng missing data trong mỗi cột:
Ngày 0 Quận 0 Phường 0 Loại hình nhà ở 0 Giấy tờ pháp lý 0 Số tầng 0 Số phòng ngủ 0 Diện tích 0 Giá/m2 0 dtype: int64
df.reset_index(drop=True, inplace=True)
df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 82484 entries, 0 to 82483 Data columns (total 9 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Ngày 82484 non-null object 1 Quận 82484 non-null object 2 Phường 82484 non-null object 3 Loại hình nhà ở 82484 non-null object 4 Giấy tờ pháp lý 82484 non-null object 5 Số tầng 82484 non-null object 6 Số phòng ngủ 82484 non-null object 7 Diện tích 82484 non-null object 8 Giá/m2 82484 non-null object dtypes: object(9) memory usage: 5.7+ MB
df['Ngày'] = pd.to_datetime(df['Ngày'])
df['Ngày'].max()
Timestamp('2020-08-05 00:00:00')
df['Ngày'].min()
Timestamp('2019-08-05 00:00:00')
number_house_per_day = df['Ngày'].value_counts(sort=False).iloc[::-1] # sort=False để giữ nguyên thứ tự ngày, iloc[::-1] để đảo ngược thứ tự
plt.figure(figsize=(12, 8))
plt.plot(number_house_per_day, color='#F38181')
plt.title('Số lượng nhà được đăng bán theo ngày')
plt.xlabel('Ngày')
plt.ylabel('Số lượng đăng bán')
plt.show()
df['Quận'].unique()
array(['Quận Cầu Giấy', 'Quận Thanh Xuân', 'Quận Hai Bà Trưng',
'Quận Tây Hồ', 'Quận Đống Đa', 'Quận Hà Đông', 'Huyện Thanh Trì',
'Quận Hoàng Mai', 'Quận Long Biên', 'Quận Hoàn Kiếm',
'Quận Nam Từ Liêm', 'Quận Ba Đình', 'Huyện Hoài Đức',
'Quận Bắc Từ Liêm', 'Huyện Đan Phượng', 'Huyện Thanh Oai',
'Huyện Sóc Sơn', 'Huyện Gia Lâm', 'Huyện Chương Mỹ',
'Huyện Đông Anh', 'Huyện Thường Tín', 'Thị xã Sơn Tây',
'Huyện Mê Linh', 'Huyện Thạch Thất', 'Huyện Quốc Oai',
'Huyện Phúc Thọ', 'Huyện Phú Xuyên', 'Huyện Ba Vì', 'Huyện Mỹ Đức'],
dtype=object)
# Replace các giá trị bị sai chính tả nếu khớp 98% trở lên
for quan in df['Quận'].unique():
replace_matches_in_column(df=df, column='Quận', string_to_match=quan, min_ratio=98)
print('Done!')
Done!
Normial category
Chuyển data-type của 'Quận' sang 'category'.
Nếu các giá trị của 1 cột là hữu hạn, ta nên đưa nó về category, nó sẽ giúp tiết kiệm bộ nhớ, cũng như có thể sử dụng các phương thức khác, mà kiểu object không thể, mặc dù cả hai đều chứa string.
Trong trường hợp, cột đó chứa feedback, hoặc description của sản phẩm, thì ta sẽ để nó ở kiểu object.
before = df['Quận'].memory_usage() # memory usage of column in bytes
print(f'Trước khi chuyển sang categoy: {before * 1e-3} kb')
Trước khi chuyển sang categoy: 660.0 kb
df['Quận'] = df['Quận'].astype('category')
after = df['Quận'].memory_usage()
print(f'Sau khi chuyển sang category: {after * 1e-3} kb')
result = (before - after) / before
print(f'Giảm tới: {round(result * 100, 2)}%')
Sau khi chuyển sang category: 83.916 kb Giảm tới: 87.29%
Sau khi chuyển kiểu dữ liệu sang category, ta có thể encode, sắp xếp hoặc so sánh (nếu như đó là ordinal category).
df['Quận'].cat.categories
Index(['Huyện Ba Vì', 'Huyện Chương Mỹ', 'Huyện Gia Lâm', 'Huyện Hoài Đức',
'Huyện Mê Linh', 'Huyện Mỹ Đức', 'Huyện Phú Xuyên', 'Huyện Phúc Thọ',
'Huyện Quốc Oai', 'Huyện Sóc Sơn', 'Huyện Thanh Oai', 'Huyện Thanh Trì',
'Huyện Thường Tín', 'Huyện Thạch Thất', 'Huyện Đan Phượng',
'Huyện Đông Anh', 'Quận Ba Đình', 'Quận Bắc Từ Liêm', 'Quận Cầu Giấy',
'Quận Hai Bà Trưng', 'Quận Hoàn Kiếm', 'Quận Hoàng Mai', 'Quận Hà Đông',
'Quận Long Biên', 'Quận Nam Từ Liêm', 'Quận Thanh Xuân', 'Quận Tây Hồ',
'Quận Đống Đa', 'Thị xã Sơn Tây'],
dtype='object')
df['Quận'].head()
0 Quận Cầu Giấy 1 Quận Thanh Xuân 2 Quận Hai Bà Trưng 3 Quận Tây Hồ 4 Quận Thanh Xuân Name: Quận, dtype: category Categories (29, object): ['Huyện Ba Vì', 'Huyện Chương Mỹ', 'Huyện Gia Lâm', 'Huyện Hoài Đức', ..., 'Quận Thanh Xuân', 'Quận Tây Hồ', 'Quận Đống Đa', 'Thị xã Sơn Tây']
df['Quận'].cat.codes[:5]
0 18 1 25 2 19 3 26 4 25 dtype: int8
sns.set_style('whitegrid')
plt.figure(figsize=(12, 8))
sns.countplot(data=df, y='Quận', palette='magma')
plt.title('Số lượng nhà được đăng bán theo quận')
plt.xlabel('Số lượng đăng bán')
plt.ylabel('Quận')
plt.show()
Ordinal Category
Việc chuyển sang Ordinal Category cũng giống như Norminal Category, nhưng ta sẽ thêm vào đó order của các giá trị.
Ví dụ, 'thấp' < 'trung bình' < 'cao'
df['Giấy tờ pháp lý'].unique()
array(['Đã có sổ', 'Unknown', 'Đang chờ sổ', 'Giấy tờ khác'], dtype=object)
Ở đây ta có 'Đã có sổ', nan, 'Đang chờ sổ', 'Giấy tờ khác', vậy ta có thể giả định ra thứ tự của nó.
'Unknown < 'Giấy tờ khác' < 'Đang chờ sổ' < 'Đã có sổ'
# Trước khi chuyển sang ordinal category
df[df['Giấy tờ pháp lý'] > 'Giấy tờ khác']['Giấy tờ pháp lý'].unique()
array(['Đã có sổ', 'Unknown', 'Đang chờ sổ'], dtype=object)
# Sau khi chuyển sang ordinal category
giay_to_phap_ly = ['Unknown', 'Giấy tờ khác', 'Đang chờ sổ', 'Đã có sổ']
df['Giấy tờ pháp lý'] = df['Giấy tờ pháp lý'].astype(CategoricalDtype(categories=giay_to_phap_ly, ordered=True))
df[df['Giấy tờ pháp lý'] > 'Giấy tờ khác']['Giấy tờ pháp lý'].unique()
['Đã có sổ', 'Đang chờ sổ'] Categories (4, object): ['Unknown' < 'Giấy tờ khác' < 'Đang chờ sổ' < 'Đã có sổ']
Note: Có thể thấy, khi lọc các entries ở cột "Giấy tờ pháp lý" có giá trị cao hơn "Giấy tờ khác", sẽ trả về các entries có giá trị là "Đã có sổ" và "Đang chờ sổ" đúng như order ta mong muốn.
df['Giấy tờ pháp lý'].head()
0 Đã có sổ 1 Unknown 2 Đã có sổ 3 Đã có sổ 4 Unknown Name: Giấy tờ pháp lý, dtype: category Categories (4, object): ['Unknown' < 'Giấy tờ khác' < 'Đang chờ sổ' < 'Đã có sổ']
plt.figure(figsize=(12, 8))
sns.countplot(data=df, x='Giấy tờ pháp lý', palette='magma')
plt.title('Số lượng nhà được đăng bán theo giấy tờ pháp lý')
plt.xlabel('Giấy tờ pháp lý')
plt.ylabel('Số lượng đăng bán')
plt.show()
df['Loại hình nhà ở'].unique()
array(['Nhà ngõ, hẻm', 'Nhà mặt phố, mặt tiền', 'Nhà biệt thự',
'Nhà phố liền kề'], dtype=object)
loai_hinh_nha_o = ['Nhà ngõ, hẻm', 'Nhà mặt phố, mặt tiền', 'Nhà phố liền kề', 'Nhà biệt thự']
df['Loại hình nhà ở'] = df['Loại hình nhà ở'].astype(CategoricalDtype(categories=loai_hinh_nha_o, ordered=True))
df['Loại hình nhà ở'].head()
0 Nhà ngõ, hẻm 1 Nhà mặt phố, mặt tiền 2 Nhà ngõ, hẻm 3 Nhà ngõ, hẻm 4 Nhà ngõ, hẻm Name: Loại hình nhà ở, dtype: category Categories (4, object): ['Nhà ngõ, hẻm' < 'Nhà mặt phố, mặt tiền' < 'Nhà phố liền kề' < 'Nhà biệt thự']
plt.figure(figsize=(12, 8))
sns.countplot(data=df, x='Loại hình nhà ở', palette='magma')
plt.title('Số lượng nhà được đăng bán theo loại hình nhà ở')
plt.xlabel('Loại hình nhà ở')
plt.ylabel('Số lượng đăng bán')
plt.show()
g = sns.catplot(data=df, x='Loại hình nhà ở', col='Giấy tờ pháp lý', kind='count', col_wrap=2, palette='magma')
g.set_axis_labels('Loại hình nhà ở', 'Số lượng đăng bán')
g.fig.suptitle('Số lượng nhà được đăng bán theo loại hình nhà ở và giấy tờ pháp lý', y=1.05)
g.set_titles('{col_name}')
g.tick_params(axis='x', rotation=45)
plt.show()
df['Phường'].unique()
array(['Phường Nghĩa Đô', 'Phường Kim Giang', 'Phường Minh Khai',
'Phường Thụy Khuê', 'Phường Yên Hoà', 'Phường Trung Liệt',
'Phường Đống Mác', 'Phường Xuân La', 'Phường Văn Quán',
'Thị trấn Văn Điển', 'Phường Định Công', 'Phường Bồ Đề',
'Phường Quang Trung', 'Phường Thanh Lương', 'Phường Khương Trung',
'Phường Phúc Tân', 'Phường Gia Thụy', 'Phường Khương Đình',
'Phường Phương Canh', 'Phường Tương Mai', 'Phường La Khê',
'Phường Mễ Trì', 'Phường Khương Mai', 'Phường Láng Hạ',
'Phường Quan Hoa', 'Phường Tây Mỗ', 'Phường Ngọc Khánh',
'Phường Đại Mỗ', 'Xã Tả Thanh Oai', 'Phường Mỹ Đình 1',
'Xã Tam Hiệp', 'Phường Cống Vị', 'Phường Bách Khoa',
'Phường Vĩnh Phúc', 'Xã Kim Chung', 'Phường Đại Kim',
'Phường Mai Động', 'Phường Trung Tự', 'Phường Kiến Hưng',
'Phường Trúc Bạch', 'Phường Cổ Nhuế 1', 'Phường Đức Giang',
'Phường Mỹ Đình 2', 'Phường Bưởi', 'Phường Ô Chợ Dừa',
'Phường Long Biên', 'Phường Hoàng Văn Thụ', 'Phường Mai Dịch',
'Phường Nhân Chính', 'Phường Vạn Phúc', 'Phường Ngọc Hà',
'Phường Lĩnh Nam', 'Phường Xuân Đỉnh', 'Phường Phú Đô',
'Phường Liễu Giai', 'Thị trấn Phùng', 'Phường Kim Liên',
'Phường Phúc Diễn', 'Phường Kim Mã', 'Phường Trung Phụng',
'Phường Tân Mai', 'Phường Cầu Diễn', 'Phường Ngã Tư Sở',
'Phường Trung Văn', 'Phường Thượng Đình', 'Phường Hoàng Liệt',
'Phường Thịnh Liệt', 'Phường Quốc Tử Giám', 'Phường Khâm Thiên',
'Phường Trương Định', 'Phường Phú Diễn', 'Phường Thạch Bàn',
'Phường Ngọc Thụy', 'Phường Cầu Dền', 'Phường Phú Lương',
'Phường Bạch Đằng', 'Phường Phú La', 'Phường Hà Cầu',
'Phường Láng Thượng', 'Phường Phương Liệt', 'Phường Vĩnh Hưng',
'Phường Thanh Nhàn', 'Phường Cự Khối', 'Phường Đội Cấn',
'Phường Thịnh Quang', 'Phường Trung Hoà', 'Phường Quỳnh Mai',
'Phường Nam Đồng', 'Phường Dịch Vọng Hậu', 'Phường Nghĩa Tân',
'Xã Cự Khê', 'Phường Vĩnh Tuy', 'Phường Quảng An',
'Phường Yên Nghĩa', 'Phường Thành Công', 'Phường Giáp Bát',
'Phường Dịch Vọng', 'Phường Thanh Xuân Bắc', 'Phường Phương Mai',
'Phường Bạch Mai', 'Phường Thanh Trì', 'Phường Thượng Thanh',
'Phường Trần Phú', 'Phường Nguyễn Trãi', 'Phường Dương Nội',
'Phường Hạ Đình', 'Phường Thanh Xuân Nam', 'Xã Vân Canh',
'Xã Phù Lỗ', 'Phường Phố Huế', 'Phường Đồng Tâm',
'Phường Xuân Phương', 'Phường Phạm Đình Hổ', 'Xã La Phù',
'Phường Ngọc Lâm', 'Phường Mộ Lao', 'Phường Phú Thượng',
'Phường Việt Hưng', 'Phường Đông Ngạc', 'Phường Thổ Quan',
'Phường Lê Đại Hành', 'Phường Khương Thượng', 'Phường Phú Lãm',
'Xã Cổ Bi', 'Phường Biên Giang', 'Phường Hàng Bột',
'Phường Cổ Nhuế 2', 'Phường Giảng Võ', 'Thị trấn Chúc Sơn',
'Xã Kiêu Kỵ', 'Phường Cát Linh', 'Phường Quỳnh Lôi',
'Phường Yên Sở', 'Xã Đặng Xá', 'Phường Yết Kiêu',
'Phường Cửa Đông', 'Phường Giang Biên', 'Phường Chương Dương',
'Phường Phúc La', 'Phường Phúc Đồng', 'Phường Thượng Cát',
'Phường Phúc Xá', 'Phường Văn Chương', 'Xã Tứ Hiệp', 'Xã Đông Dư',
'Phường Thanh Xuân Trung', 'Phường Phương Liên', 'Phường Nhật Tân',
'Thị trấn Trạm Trôi', 'Phường Sài Đồng', 'Xã Tân Triều',
'Phường Văn Miếu', 'Xã Đông Hội', 'Xã Phụng Châu',
'Thị trấn Trâu Quỳ', 'Phường Quán Thánh', 'Phường Phúc Lợi',
'Xã Hữu Hoà', 'Phường Đồng Nhân', 'Phường Ngô Thì Nhậm',
'Phường Đồng Mai', 'Xã Đông La', 'Phường Liên Mạc', 'Xã Ngọc Hồi',
'Phường Bùi Thị Xuân', 'Phường Xuân Tảo', 'Phường Yên Phụ',
'Xã Thanh Liệt', 'Phường Thụy Phương', 'Phường Hàng Bông',
'Xã Nghiêm Xuyên', 'Phường Nguyễn Du', 'Phường Tứ Liên',
'Phường Phan Chu Trinh', 'Xã Vĩnh Quỳnh', 'Phường Cửa Nam',
'Xã Di Trạch', 'Phường Hàng Bồ', 'Xã Võng La', 'Phường Điện Biên',
'Xã Bắc Hồng', 'Xã Hải Bối', 'Xã Đại Yên', 'Phường Ngô Quyền',
'Phường Trần Hưng Đạo', 'Xã Liên Ninh', 'Phường Hàng Bài',
'Xã Đông Mỹ', 'Phường Đức Thắng', 'Phường Tràng Tiền',
'Phường Hàng Bạc', 'Xã Ngũ Hiệp', 'Xã An Thượng',
'Phường Hàng Đào', 'Xã Yên Thường', 'Xã Duyên Hà',
'Phường Đồng Xuân', 'Phường Lý Thái Tổ', 'Xã An Khánh',
'Thị trấn Yên Viên', 'Phường Hàng Buồm', 'Xã Lại Yên',
'Xã Bích Hòa', 'Thị trấn Quang Minh', 'Thị trấn Kim Bài',
'Xã Khánh Hà', 'Phường Tây Tựu', 'Xã Thủy Xuân Tiên', 'Xã Kim Nỗ',
'Phường Hàng Trống', 'Xã Tân Lập', 'Xã Đại Thịnh',
'Phường Hàng Mã', 'Xã Bình Yên', 'Xã Vạn Phúc', 'Xã Phú Cường',
'Xã Đa Tốn', 'Xã Minh Phú', 'Phường Nguyễn Trung Trực',
'Thị trấn Quốc Oai', 'Thị trấn Thường Tín', 'Phường Phú Thịnh',
'Xã Đại áng', 'Xã Võng Xuyên', 'Xã Phú Mãn', 'Thị trấn Phú Xuyên',
'Xã Hà Hồi', 'Xã Phú Châu', 'Xã Cổ Đông', 'Xã Vân Côn',
'Xã Xuân Giang', 'Xã Tam Đồng', 'Xã Dương Quang',
'Thị trấn Đông Anh', 'Xã Đông Yên', 'Xã Vân Nội', 'Xã Tiên Dược',
'Xã Hương Ngải', 'Xã Hoàng Văn Thụ', 'Xã Ngọc Liệp', 'Xã Nhị Khê',
'Thị trấn Xuân Mai', 'Xã Bát Tràng', 'Xã Nam Hồng', 'Xã Thạch Hoà',
'Xã Tam Hưng', 'Xã Nguyên Khê', 'Xã Sài Sơn', 'Xã Ninh Hiệp',
'Xã Uy Nỗ', 'Phường Viên Sơn', 'Xã Ninh Sở', 'Xã Phương Trung',
'Xã Vĩnh Ngọc', 'Xã Đại Mạch', 'Xã Kim Sơn', 'Xã Minh Khai',
'Xã Phú Cát', 'Xã Duyên Thái', 'Xã Vân Hòa',
'Phường Trung Sơn Trầm', 'Xã Dương Xá', 'Xã Xuân Nộn',
'Xã Việt Hùng', 'Xã Sơn Đông', 'Xã Văn Bình', 'Phường Hàng Gai',
'Xã Thanh Cao', 'Xã Mai Đình', 'Xã Đông Xuân', 'Xã Mai Lâm',
'Xã Sơn Đồng', 'Xã Tân Xã', 'Phường Xuân Khanh', 'Xã Thượng Mỗ',
'Xã Nghĩa Hương', 'Xã Dương Liễu', 'Xã Đức Thượng', 'Xã Kim Hoa',
'Xã Tiền Phong', 'Xã Bình Phú', 'Xã Dục Tú', 'Xã Đức Giang',
'Xã Yên Viên', 'Xã Đồng Quang', 'Xã Quang Tiến', 'Xã Đại Thành',
'Xã Hòa Thạch', 'Xã Tiến Xuân', 'Xã Phù Linh', 'Xã Đỗ Động',
'Xã Phú Minh', 'Xã Tiên Dương', 'Xã Hợp Thanh', 'Xã Minh Trí',
'Xã Tân Hội', 'Xã Thanh Xuân', 'Xã Song Phương', 'Xã Lê Lợi',
'Thị trấn Sóc Sơn', 'Thị trấn Liên Quan', 'Xã Mê Linh',
'Xã Đan Phượng', 'Xã Vân Tảo', 'Xã Đình Xuyên', 'Xã Phù Đổng',
'Xã Phú Sơn', 'Xã Ngọc Tảo', 'Xã Phương Đình'], dtype=object)
df['Phường'] = df['Phường'].astype('category')
df['Số tầng'].unique()
array(['4', 'Unknown', '6', '5', '7', '2', '3', '8', '1', '9', '50', '38',
'35', '10', 'Nhiều hơn 10', '45', '33', '42', '25', '73', '12',
'65', '55', '30', '14', '40', '52', '54', '32', '29'], dtype=object)
df['Số tầng'].value_counts()
Số tầng Unknown 46089 5 15767 4 12277 3 3619 6 2119 2 1028 1 636 7 597 8 188 9 88 10 36 45 8 Nhiều hơn 10 7 35 6 50 2 12 2 38 2 30 1 32 1 54 1 52 1 40 1 14 1 65 1 55 1 73 1 25 1 42 1 33 1 29 1 Name: count, dtype: int64
Số lượng các nhà có tầng nhiều hơn 10 nhỏ, do vậy ta đưa chúng về '>10'
def process_so_tang(x):
try:
if x == 'Nhiều hơn 10' or int(x) > 10:
return '>10'
return x
except:
return x
df['Số tầng'] = df['Số tầng'].apply(process_so_tang)
df['Số tầng'].value_counts()
Số tầng Unknown 46089 5 15767 4 12277 3 3619 6 2119 2 1028 1 636 7 597 8 188 9 88 >10 40 10 36 Name: count, dtype: int64
# Đưa cột 'Số tầng' về kiểu ordinal category
so_tang = ['Unknown', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '>10']
df['Số tầng'] = df['Số tầng'].astype(CategoricalDtype(categories=so_tang, ordered=True))
df['Số tầng'].head()
0 4 1 Unknown 2 4 3 Unknown 4 Unknown Name: Số tầng, dtype: category Categories (12, object): ['Unknown' < '1' < '2' < '3' ... '8' < '9' < '10' < '>10']
plt.figure(figsize=(12, 8))
sns.countplot(data=df, x='Số tầng', palette='magma')
plt.title('Số lượng nhà được đăng bán theo số tầng')
plt.xlabel('Số tầng')
plt.ylabel('Số lượng đăng bán')
plt.show()
g = sns.catplot(data=df, x='Số tầng', col='Giấy tờ pháp lý', kind='count', col_wrap=2, palette='magma')
g.fig.suptitle('Số lượng nhà được đăng bán theo số tầng và giấy tờ pháp lý', y=1.05)
g.set_axis_labels('Số tầng', 'Số lượng đăng bán')
plt.show()
df['Số phòng ngủ'].unique()
array(['5 phòng', '3 phòng', '4 phòng', '6 phòng', 'nhiều hơn 10 phòng',
'8 phòng', '2 phòng', '7 phòng', '9 phòng', '1 phòng', '10 phòng'],
dtype=object)
# Đưa category 'nhiều hơn 10 phòng' về 15 phòng
df['Số phòng ngủ'].replace('nhiều hơn 10 phòng', '15 phòng', inplace=True)
# Đưa cột 'Số phòng ngủ' về kiểu numeric
df['Số phòng ngủ'] = df['Số phòng ngủ'].str.replace('phòng', '')
df['Số phòng ngủ'] = df['Số phòng ngủ'].astype('int')
plt.figure(figsize=(12, 8))
sns.countplot(data=df, x='Số phòng ngủ', palette='magma')
plt.title('Số lượng nhà được đăng bán theo số phòng ngủ')
plt.xlabel('Số phòng ngủ')
plt.ylabel('Số lượng đăng bán')
plt.show()
df['Diện tích'] = df['Diện tích'].apply(lambda x: x.replace('m²', '').replace(',', '.')).astype(float)
df['Giá/m2'].value_counts()
Giá/m2
100 triệu/m² 2503
80 triệu/m² 1156
75 triệu/m² 963
90 triệu/m² 839
83,33 triệu/m² 810
...
126,25 triệu/m² 1
107,43 triệu/m² 1
67.567 đ/m² 1
116,49 triệu/m² 1
341,46 triệu/m² 1
Name: count, Length: 8345, dtype: int64
print('Đơn vị tính:')
don_vi_tinh = df['Giá/m2'].apply(lambda x: x.split(' ')[1])
don_vi_tinh.value_counts()
Đơn vị tính:
Giá/m2 triệu/m² 81626 đ/m² 740 tỷ/m² 118 Name: count, dtype: int64
df[don_vi_tinh == 'đ/m²']
| Ngày | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|
| 93 | 2020-08-04 | Quận Nam Từ Liêm | Phường Cầu Diễn | Nhà phố liền kề | Đã có sổ | 5 | 4 | 113.000000000 | 247.787 đ/m² |
| 174 | 2020-08-04 | Quận Nam Từ Liêm | Phường Mỹ Đình 1 | Nhà ngõ, hẻm | Unknown | Unknown | 1 | 30.000000000 | 1 đ/m² |
| 283 | 2020-08-04 | Quận Đống Đa | Phường Kim Liên | Nhà ngõ, hẻm | Unknown | Unknown | 3 | 42.000000000 | 90.476 đ/m² |
| 338 | 2020-08-04 | Quận Long Biên | Phường Ngọc Thụy | Nhà ngõ, hẻm | Đã có sổ | Unknown | 3 | 140.000000000 | 178.571 đ/m² |
| 351 | 2020-08-04 | Quận Hoàng Mai | Phường Tân Mai | Nhà mặt phố, mặt tiền | Đã có sổ | 5 | 6 | 60.000000000 | 125.000 đ/m² |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 82282 | 2020-05-10 | Quận Tây Hồ | Phường Xuân La | Nhà ngõ, hẻm | Đã có sổ | 6 | 5 | 49.000000000 | 59.183 đ/m² |
| 82304 | 2020-05-07 | Quận Đống Đa | Phường Láng Thượng | Nhà ngõ, hẻm | Đã có sổ | Unknown | 4 | 45.000000000 | 85.555 đ/m² |
| 82313 | 2020-05-04 | Quận Đống Đa | Phường Ô Chợ Dừa | Nhà ngõ, hẻm | Đã có sổ | Unknown | 4 | 38.000000000 | 86.842 đ/m² |
| 82332 | 2020-04-27 | Quận Hoàng Mai | Phường Hoàng Văn Thụ | Nhà ngõ, hẻm | Unknown | Unknown | 3 | 46.000000000 | 69.565 đ/m² |
| 82337 | 2020-04-22 | Quận Đống Đa | Phường Thổ Quan | Nhà ngõ, hẻm | Đã có sổ | Unknown | 3 | 35.000000000 | 105.714 đ/m² |
740 rows × 9 columns
Nhận xét: Có thể đ/m² chính là triệu/m²
df[don_vi_tinh == 'tỷ/m²']
| Ngày | Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Giá/m2 | |
|---|---|---|---|---|---|---|---|---|---|
| 1100 | 2020-08-04 | Quận Thanh Xuân | Phường Khương Trung | Nhà ngõ, hẻm | Unknown | Unknown | 3 | 36.000000000 | 1,202777777 tỷ/m² |
| 1144 | 2020-08-04 | Quận Đống Đa | Phường Láng Hạ | Nhà ngõ, hẻm | Đã có sổ | 5 | 3 | 35.000000000 | 1,142857142 tỷ/m² |
| 1657 | 2020-08-04 | Quận Hà Đông | Phường La Khê | Nhà phố liền kề | Unknown | Unknown | 6 | 5.000000000 | 1,96 tỷ/m² |
| 2849 | 2020-08-03 | Quận Thanh Xuân | Phường Thanh Xuân Trung | Nhà ngõ, hẻm | Unknown | Unknown | 2 | 35.000000000 | 1,557142857 tỷ/m² |
| 2939 | 2020-08-03 | Quận Hai Bà Trưng | Phường Minh Khai | Nhà ngõ, hẻm | Đã có sổ | Unknown | 5 | 3.990000000 | 1,316666666 tỷ/m² |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 78096 | 2020-06-09 | Huyện Hoài Đức | Xã Vân Canh | Nhà ngõ, hẻm | Đã có sổ | 4 | 3 | 30.000000000 | 5,833333333 tỷ/m² |
| 79023 | 2020-06-09 | Quận Đống Đa | Phường Láng Thượng | Nhà ngõ, hẻm | Đã có sổ | 4 | 4 | 40.000000000 | 1,0125 tỷ/m² |
| 79824 | 2020-06-08 | Quận Đống Đa | Phường Nam Đồng | Nhà ngõ, hẻm | Đã có sổ | Unknown | 3 | 45.000000000 | 1,706666666 tỷ/m² |
| 80211 | 2020-06-08 | Quận Hoàn Kiếm | Phường Lý Thái Tổ | Nhà mặt phố, mặt tiền | Unknown | Unknown | 4 | 100.000000000 | 1,5 tỷ/m² |
| 81834 | 2020-06-06 | Quận Đống Đa | Phường Láng Thượng | Nhà phố liền kề | Đã có sổ | 7 | 15 | 65.000000000 | 2,538461538 tỷ/m² |
118 rows × 9 columns
Ta sẽ xử lý bằng cách thêm cột "Đơn vị tính", và bỏ đơn vị trong cột "Giá/m2", đưa các giá trị trong cột "Giá/m2" về numerical
df['Đơn vị tính'] = df['Giá/m2'].apply(lambda x: x.split(' ')[1])
df['Giá/m2'] = df['Giá/m2'].apply(lambda x: x.split(' ')[0])
df['Đơn vị tính'] = df['Đơn vị tính'].astype('category')
Trong cột 'Giá/m2' có các giá trị không thể chuyển sang float
idx, values = extract_idx_value(df['Giá/m2'].apply(lambda x: x.replace(',', '.')))
for _idx, value in zip(idx, values):
try:
float(value)
except:
print(_idx, value)
52315 2.222.22220022 55649 728.000.00728 57999 69.736.842105263
Nhận xét: Các giá trị cũng không hợp lý với cột 'Giá/m2'
df.drop([52315, 55649, 57999], inplace=True)
df['Giá/m2'] = df['Giá/m2'].apply(lambda x: x.replace(',', '.')).astype(float)
df.reset_index(drop=True, inplace=True)
df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 82481 entries, 0 to 82480 Data columns (total 10 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Ngày 82481 non-null datetime64[ns] 1 Quận 82481 non-null category 2 Phường 82481 non-null category 3 Loại hình nhà ở 82481 non-null category 4 Giấy tờ pháp lý 82481 non-null category 5 Số tầng 82481 non-null category 6 Số phòng ngủ 82481 non-null int32 7 Diện tích 82481 non-null float64 8 Giá/m2 82481 non-null float64 9 Đơn vị tính 82481 non-null category dtypes: category(6), datetime64[ns](1), float64(2), int32(1) memory usage: 2.8 MB
Nhận xét: Dữ liệu đã được làm sạch về kiểu dữ liệu
df.describe()
| Ngày | Số phòng ngủ | Diện tích | Giá/m2 | |
|---|---|---|---|---|
| count | 82481 | 82481.000000000 | 82481.000000000 | 82481.000000000 |
| mean | 2020-07-07 16:47:42.506516736 | 3.924188601 | 51.365493993 | 102.919835309 |
| min | 2019-08-05 00:00:00 | 1.000000000 | 1.000000000 | 1.000000000 |
| 25% | 2020-06-23 00:00:00 | 3.000000000 | 34.000000000 | 73.200000000 |
| 50% | 2020-07-09 00:00:00 | 4.000000000 | 40.000000000 | 90.000000000 |
| 75% | 2020-07-24 00:00:00 | 4.000000000 | 50.000000000 | 110.750000000 |
| max | 2020-08-05 00:00:00 | 15.000000000 | 111411.000000000 | 998.000000000 |
| std | NaN | 1.734691080 | 470.715103207 | 66.060850235 |
Tạo feature 'Giá' bằng 'Giá/m2' * 'Diện tích' với đơn vị là tỷ. Các entries có 'Đơn vị tính' là 'triệu/m²' sẽ chia cho 1000
for row, col in df.iterrows():
df.loc[row, 'Giá'] = col['Giá/m2'] * col['Diện tích']
if col['Đơn vị tính'] != 'tỷ/m²':
df.loc[row, 'Giá'] /= 1000
Tạo feature 'Nội thành'
df['Nội thành'] = df['Quận'].apply(lambda x: 1 if 'Quận' in x else 0)
Tạo feature 'Năm', 'Tháng'
df['Năm'] = df['Ngày'].dt.year
df['Tháng'] = df['Ngày'].dt.month
df_train, df_test = train_test_split(df, test_size=0.2, random_state=42)
sns.boxplot(data=df_train, x='Diện tích', color='#F38181')
plt.title('Boxplot diện tích')
plt.xlabel('Diện tích')
plt.show()
sns.boxplot(data=df_train, x='Giá', color='#F38181')
plt.title('Boxplot giá')
plt.xlabel('Giá')
plt.show()
Nhận xét: Với dữ liệu có giá trị outliers quá lớn như này, ta cần loại bỏ để có thể phân tích dễ dàng hơn, và xây dựng được mô hình dự đoán tốt hơn
# iqr_dien_tich = df_train['Diện tích'].quantile(0.75) - df_train['Diện tích'].quantile(0.25)
# upper_bound_dien_tich = df_train['Diện tích'].quantile(0.75) + 1.5 * iqr_dien_tich
# lower_bound_dien_tich = df_train['Diện tích'].quantile(0.25) - 1.5 * iqr_dien_tich
# df_train_no_outlier_dien_tich = df_train[(df_train['Diện tích'] < upper_bound_dien_tich) & (df_train['Diện tích'] > lower_bound_dien_tich)]
# print(f'Số lượng outlier: {len(df_train) - len(df_train_no_outlier_dien_tich)}')
# iqr_gia = df_train_no_outlier_dien_tich['Giá'].quantile(0.75) - df_train_no_outlier_dien_tich['Giá'].quantile(0.25)
# upper_bound_gia = df_train_no_outlier_dien_tich['Giá'].quantile(0.75) + 1.5 * iqr_gia
# lower_bound_gia = df_train_no_outlier_dien_tich['Giá'].quantile(0.25) - 1.5 * iqr_gia
# df_train_no_outlier = df_train_no_outlier_dien_tich[(df_train_no_outlier_dien_tich['Giá'] < upper_bound_gia) & (df_train_no_outlier_dien_tich['Giá'] > lower_bound_gia)]
iqr = df_train['Giá'].quantile(0.75) - df_train['Giá'].quantile(0.25)
upper_bound = df_train['Giá'].quantile(0.75) + 1.5 * iqr
lower_bound = df_train['Giá'].quantile(0.25) - 1.5 * iqr
df_train_no_outlier = df_train[(df_train['Giá'] < upper_bound) & (df_train['Giá'] > lower_bound)]
print(f'Số lượng outlier: {len(df_train) - len(df_train_no_outlier)}')
Số lượng outlier: 5998
sns.boxplot(data=df_train_no_outlier, x='Diện tích', color='#F38181')
plt.title('Boxplot diện tích no outlier')
plt.xlabel('Diện tích')
plt.show()
sns.boxplot(data=df_train_no_outlier, x='Giá', color='#F38181')
plt.title('Boxplot giá no outlier')
plt.xlabel('Giá')
plt.show()
df_train_no_outlier.describe()
| Ngày | Số phòng ngủ | Diện tích | Giá/m2 | Giá | Nội thành | Năm | Tháng | |
|---|---|---|---|---|---|---|---|---|
| count | 59986 | 59986.000000000 | 59986.000000000 | 59986.000000000 | 59986.000000000 | 59986.000000000 | 59986.000000000 | 59986.000000000 |
| mean | 2020-07-07 20:32:36.936618496 | 3.766562198 | 43.010886207 | 90.638735977 | 3.738515133 | 0.972293535 | 2019.999799953 | 6.724635748 |
| min | 2019-08-05 00:00:00 | 1.000000000 | 1.000000000 | 1.000000000 | 0.026000000 | 0.000000000 | 2019.000000000 | 2.000000000 |
| 25% | 2020-06-23 00:00:00 | 3.000000000 | 33.000000000 | 71.670000000 | 2.699900000 | 1.000000000 | 2020.000000000 | 6.000000000 |
| 50% | 2020-07-09 00:00:00 | 4.000000000 | 40.000000000 | 87.180000000 | 3.400000000 | 1.000000000 | 2020.000000000 | 7.000000000 |
| 75% | 2020-07-24 00:00:00 | 4.000000000 | 48.000000000 | 103.850000000 | 4.500000000 | 1.000000000 | 2020.000000000 | 7.000000000 |
| max | 2020-08-05 00:00:00 | 15.000000000 | 3600.000000000 | 990.000000000 | 8.620080000 | 1.000000000 | 2020.000000000 | 12.000000000 |
| std | NaN | 1.439798978 | 33.060746220 | 35.051544716 | 1.561772149 | 0.164131855 | 0.014142489 | 0.638457095 |
print('Giá nhà cao nhất:', df_train_no_outlier['Giá'].max(), 'tỷ')
print('Giá nhà thấp nhất:', df_train_no_outlier['Giá'].min(), 'tỷ')
Giá nhà cao nhất: 8.62008 tỷ Giá nhà thấp nhất: 0.026 tỷ
sns.displot(data=df_train_no_outlier, x='Giá', bins=50, kde=False, color='#F38181')
plt.title('Phân phối giá nhà')
plt.xlabel('Giá nhà (tỷ)')
plt.ylabel('Số lượng')
plt.show()
plt.figure(figsize=(12, 8))
sns.countplot(data=df_train_no_outlier, y='Quận', hue='Nội thành', order=df_train_no_outlier['Quận'].value_counts().index, palette='magma')
plt.title('Số lượng rao bán theo quận')
plt.xlabel('Số lượng rao bán')
plt.ylabel('Quận')
plt.show()
df_train_no_outlier.groupby('Quận')['Giá'].mean().sort_values(ascending=False)
Quận Huyện Thạch Thất 4.716751818 Quận Cầu Giấy 4.614868398 Huyện Ba Vì 4.550900000 Quận Tây Hồ 4.331509429 Quận Ba Đình 4.035464759 Quận Đống Đa 3.962753463 Quận Hoàn Kiếm 3.938248184 Quận Thanh Xuân 3.903992474 Huyện Đan Phượng 3.873916667 Huyện Quốc Oai 3.823306923 Quận Nam Từ Liêm 3.738562248 Quận Long Biên 3.669182394 Quận Hai Bà Trưng 3.647365911 Quận Bắc Từ Liêm 3.561365469 Huyện Gia Lâm 3.354397628 Quận Hà Đông 3.271504117 Quận Hoàng Mai 3.270854406 Huyện Mê Linh 3.138794286 Huyện Mỹ Đức 2.899700000 Huyện Chương Mỹ 2.689513750 Huyện Thanh Trì 2.679601371 Huyện Đông Anh 2.545112824 Thị xã Sơn Tây 2.434942857 Huyện Phúc Thọ 2.312555000 Huyện Sóc Sơn 2.241320000 Huyện Thường Tín 2.163403636 Huyện Hoài Đức 2.046004912 Huyện Thanh Oai 1.633831978 Huyện Phú Xuyên NaN Name: Giá, dtype: float64
gia_trung_binh_theo_quan = df_train_no_outlier.groupby('Quận')['Giá'].mean().sort_values(ascending=False)
plt.figure(figsize=(12, 8))
sns.barplot(
x=gia_trung_binh_theo_quan.values, y=gia_trung_binh_theo_quan.index,
order=gia_trung_binh_theo_quan.index, palette='magma'
)
plt.xlabel('Giá trung bình (tỷ VND)')
plt.ylabel('Quận')
plt.title('Giá trung bình theo quận')
plt.show()
g = sns.catplot(data=df_train_no_outlier, x='Loại hình nhà ở', y='Giá', palette='magma', col='Giấy tờ pháp lý', col_wrap=2, kind='point')
g.set_axis_labels('Loại hình nhà ở', 'Giá nhà (tỷ)')
g.fig.suptitle('Giá nhà theo loại hình nhà ở và giấy tờ pháp lý', y=1.05)
g.tick_params(axis='x', rotation=45)
plt.show()
sns.boxplot(data=df_train_no_outlier, x='Số tầng', y='Giá', palette='magma')
plt.title('Giá nhà theo số tầng')
plt.xlabel('Số tầng')
plt.ylabel('Giá nhà (tỷ)')
plt.show()
sns.boxplot(data=df_train_no_outlier, x='Số phòng ngủ', y='Giá', palette='magma')
plt.title('Giá nhà theo số phòng ngủ')
plt.xlabel('Số phòng ngủ')
plt.ylabel('Giá nhà (tỷ)')
plt.show()
sns.boxplot(data=df_train_no_outlier, x='Nội thành', y='Giá', palette='magma')
plt.title('Giá nhà theo khu vực')
plt.xlabel('Nội thành')
plt.ylabel('Giá nhà (tỷ)')
plt.show()
sns.boxplot(data=df_train_no_outlier, x='Năm', y='Giá', palette='magma')
plt.title('Giá nhà theo năm')
plt.xlabel('Năm')
plt.ylabel('Giá nhà (tỷ)')
plt.show()
X = df_train_no_outlier.copy()
y = X.pop('Giá')
X.drop(['Ngày', 'Giá/m2', 'Đơn vị tính'], axis=1, inplace=True)
X.head()
| Quận | Phường | Loại hình nhà ở | Giấy tờ pháp lý | Số tầng | Số phòng ngủ | Diện tích | Nội thành | Năm | Tháng | |
|---|---|---|---|---|---|---|---|---|---|---|
| 7743 | Quận Hà Đông | Phường Yên Nghĩa | Nhà ngõ, hẻm | Đã có sổ | Unknown | 4 | 36.000000000 | 1 | 2020 | 7 |
| 28533 | Quận Ba Đình | Phường Đội Cấn | Nhà ngõ, hẻm | Đã có sổ | 4 | 4 | 35.000000000 | 1 | 2020 | 7 |
| 18024 | Quận Tây Hồ | Phường Thụy Khuê | Nhà ngõ, hẻm | Unknown | Unknown | 4 | 55.000000000 | 1 | 2020 | 7 |
| 22660 | Quận Cầu Giấy | Phường Trung Hoà | Nhà ngõ, hẻm | Đã có sổ | 5 | 5 | 38.000000000 | 1 | 2020 | 7 |
| 8654 | Quận Đống Đa | Phường Trung Liệt | Nhà ngõ, hẻm | Đã có sổ | 4 | 4 | 40.000000000 | 1 | 2020 | 7 |
X_baseline = X.loc[:, ['Số phòng ngủ', 'Diện tích', 'Nội thành', 'Năm', 'Tháng']]
X_baseline.info()
<class 'pandas.core.frame.DataFrame'> Index: 59986 entries, 7743 to 15795 Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Số phòng ngủ 59986 non-null int32 1 Diện tích 59986 non-null float64 2 Nội thành 59986 non-null int64 3 Năm 59986 non-null int32 4 Tháng 59986 non-null int32 dtypes: float64(1), int32(3), int64(1) memory usage: 4.1 MB
baseline_classifier = Classifier()
baseline_classifier.fit(X_baseline, y)
100%|██████████| 7/7 [01:34<00:00, 13.57s/it]
baseline_summary = baseline_classifier.summary()
baseline_summary.sort_values(by=['Score RMSE', 'Std RMSE', 'Score MAE', 'Std MAE'], ascending=True)
| Score RMSE | Std RMSE | Score MAE | Std MAE | |
|---|---|---|---|---|
| LightGBM | 1.193875412 | 0.005856197 | 1.425372795 | 0.013990414 |
| CatBoost | 1.194452341 | 0.005790013 | 1.426749919 | 0.013833514 |
| XGBoost | 1.202133436 | 0.005737942 | 1.445157723 | 0.013803951 |
| Random Forest | 1.215559538 | 0.003290024 | 1.477595815 | 0.008002134 |
| Decision Tree | 1.237264182 | 0.004062694 | 1.530839162 | 0.010052551 |
| KNN | 1.302730549 | 0.008677827 | 1.697182188 | 0.022583137 |
| Linear Model | 1.396724599 | 0.016728453 | 1.951119448 | 0.047000578 |
categorical_cols = ['Quận', 'Phường', 'Giấy tờ pháp lý', 'Loại hình nhà ở', 'Số tầng']
X_ordinal = X.copy()
for col in categorical_cols:
X_ordinal[col] = X_ordinal[col].cat.codes
ordinal_encode_classifier = Classifier()
ordinal_encode_classifier.fit(X_ordinal, y)
100%|██████████| 7/7 [02:47<00:00, 23.90s/it]
ordinal_encode_summary = ordinal_encode_classifier.summary()
ordinal_encode_summary.sort_values(by=['Score RMSE', 'Std RMSE', 'Score MAE', 'Std MAE'], ascending=True)
| Score RMSE | Std RMSE | Score MAE | Std MAE | |
|---|---|---|---|---|
| XGBoost | 1.020326491 | 0.008961631 | 1.041146460 | 0.018282841 |
| LightGBM | 1.031640688 | 0.008520493 | 1.064355108 | 0.017565600 |
| CatBoost | 1.038141503 | 0.006634066 | 1.077781791 | 0.013757690 |
| Random Forest | 1.061544071 | 0.013949685 | 1.127070409 | 0.029671266 |
| KNN | 1.123212615 | 0.011549279 | 1.261739964 | 0.025991873 |
| Linear Model | 1.343356789 | 0.014819831 | 1.804827089 | 0.039955905 |
| Decision Tree | 1.363716999 | 0.014818507 | 1.859943642 | 0.040475704 |
print('Số lượng unique value trong mỗi cột:')
for col in X.select_dtypes('category'):
print(col.ljust(37), len(X[col].unique()))
Số lượng unique value trong mỗi cột: Quận 28 Phường 284 Loại hình nhà ở 4 Giấy tờ pháp lý 4 Số tầng 12
ordinal_cols = ['Quận', 'Phường', 'Số tầng']
onehot_cols = ['Giấy tờ pháp lý', 'Loại hình nhà ở', 'Nội thành']
oh_encoder = OneHotEncoder(handle_unknown='ignore', sparse_output=False, drop='first')
X_cb = X.copy()
for col in ordinal_cols:
X_cb[col] = X_cb[col].cat.codes
X_cb.reset_index(drop=True, inplace=True)
oh_X = pd.DataFrame(oh_encoder.fit_transform(X_cb.loc[:, onehot_cols]))
X_cb = pd.concat([X_cb, oh_X], axis=1)
X_cb.columns = X_cb.columns.astype(str)
X_cb.drop(onehot_cols, axis=1, inplace=True)
cb_encode_classifier = Classifier()
cb_encode_classifier.fit(X_cb, y)
100%|██████████| 7/7 [02:52<00:00, 24.60s/it]
cb_encode_summary = cb_encode_classifier.summary()
cb_encode_summary.sort_values(by=['Score RMSE', 'Std RMSE', 'Score MAE', 'Std MAE'], ascending=True)
| Score RMSE | Std RMSE | Score MAE | Std MAE | |
|---|---|---|---|---|
| XGBoost | 1.020917518 | 0.010821730 | 1.042389689 | 0.022075314 |
| LightGBM | 1.031392666 | 0.008999342 | 1.063851820 | 0.018548854 |
| CatBoost | 1.038912752 | 0.006332347 | 1.079379804 | 0.013151070 |
| Random Forest | 1.061052418 | 0.013429359 | 1.126012581 | 0.028581899 |
| KNN | 1.108106149 | 0.012805391 | 1.228063215 | 0.028356517 |
| Linear Model | 1.337452507 | 0.015857082 | 1.789030656 | 0.042586767 |
| Decision Tree | 1.358047509 | 0.009053497 | 1.844375003 | 0.024558542 |
scaler = StandardScaler()
X_scaled = pd.DataFrame(scaler.fit_transform(X_ordinal))
X_scaled.columns = X_ordinal.columns.astype(str)
scaled_classifier = Classifier()
scaled_classifier.fit(X_scaled, y)
100%|██████████| 7/7 [02:56<00:00, 25.15s/it]
scaled_summary = scaled_classifier.summary()
scaled_summary.sort_values(by=['Score RMSE', 'Std RMSE', 'Score MAE', 'Std MAE'], ascending=True)
| Score RMSE | Std RMSE | Score MAE | Std MAE | |
|---|---|---|---|---|
| XGBoost | 1.020326491 | 0.008961631 | 1.041146460 | 0.018282841 |
| LightGBM | 1.031632146 | 0.009375740 | 1.064352789 | 0.019332406 |
| CatBoost | 1.038636432 | 0.006537811 | 1.078808380 | 0.013562147 |
| Random Forest | 1.061713302 | 0.013987505 | 1.127430787 | 0.029762395 |
| KNN | 1.150066031 | 0.011592349 | 1.322786258 | 0.026639529 |
| Linear Model | 1.343356789 | 0.014819831 | 1.804827089 | 0.039955905 |
| Decision Tree | 1.363519713 | 0.015300034 | 1.859420100 | 0.041787569 |
def objective(trial, X=X_scaled, y=y):
params = {
'learning_rate': trial.suggest_float('learning_rate', 0.0001, 1),
'n_estimators': trial.suggest_int('n_estimators', 2, 8000),
'max_depth': trial.suggest_int('max_depth', 0, 20),
'min_split_loss': trial.suggest_float('min_split_loss', 0, 20),
'min_child_weight': trial.suggest_float('min_child_weight', 0, 20),
'max_delta_step': trial.suggest_float('max_delta_step', 0, 10),
'subsample': trial.suggest_float('subsample', 0.1, 1),
'sampling_method': trial.suggest_categorical('sampling_method', ['uniform', 'gradient_based']),
'lambda': trial.suggest_float('lambda', 0, 20),
'grow_policy': trial.suggest_categorical('grow_policy', ['depthwise', 'lossguide']),
'max_leaves': trial.suggest_int('max_leaves', 0, 20),
'max_bin': trial.suggest_int('max_bin', 2, 256)
}
kf = KFold(n_splits=5)
scores = []
for train_index, val_index in kf.split(X):
X_train, X_val = X.iloc[train_index], X.iloc[val_index]
y_train, y_val = y.iloc[train_index], y.iloc[val_index]
model = XGBRegressor(**params, random_state=42, n_jobs=-1, tree_method='gpu_hist')
model.fit(X_train, y_train, verbose=False)
y_pred = model.predict(X_val)
test_score = mean_squared_error(y_val, y_pred, squared=False)
scores.append(test_score)
return np.mean(scores)
study = optuna.create_study(direction='minimize')
study.optimize(objective, n_trials=200)
print('Number of finished trials:', len(study.trials))
print('Best trial:', study.best_trial.params)
[I 2023-07-13 07:00:02,210] A new study created in memory with name: no-name-5de976e5-bce4-4fd0-a123-788a45a79b1c
[I 2023-07-13 07:02:05,356] Trial 0 finished with value: 0.905041352516631 and parameters: {'learning_rate': 0.7657335367112077, 'n_estimators': 7378, 'max_depth': 15, 'min_split_loss': 2.958206039217528, 'min_child_weight': 7.580447635881981, 'max_delta_step': 5.647863754928668, 'subsample': 0.8072483305725084, 'sampling_method': 'uniform', 'lambda': 19.701628001392397, 'grow_policy': 'depthwise', 'max_leaves': 10, 'max_bin': 67}. Best is trial 0 with value: 0.905041352516631.
[I 2023-07-13 07:03:34,615] Trial 1 finished with value: 0.9182928843369556 and parameters: {'learning_rate': 0.7902764505674427, 'n_estimators': 4841, 'max_depth': 9, 'min_split_loss': 4.552904689865807, 'min_child_weight': 13.780428625412739, 'max_delta_step': 0.5527740392772806, 'subsample': 0.574060997975983, 'sampling_method': 'uniform', 'lambda': 17.603454181421018, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 92}. Best is trial 0 with value: 0.905041352516631.
[I 2023-07-13 07:04:33,720] Trial 2 finished with value: 0.9294586883822952 and parameters: {'learning_rate': 0.2974020166023161, 'n_estimators': 3341, 'max_depth': 12, 'min_split_loss': 8.938245413930094, 'min_child_weight': 13.747114715259634, 'max_delta_step': 4.1335058821563635, 'subsample': 0.6151102590057544, 'sampling_method': 'uniform', 'lambda': 18.911885902381933, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 25}. Best is trial 0 with value: 0.905041352516631.
[I 2023-07-13 07:05:37,910] Trial 3 finished with value: 0.9058567674069048 and parameters: {'learning_rate': 0.41263694014317714, 'n_estimators': 6584, 'max_depth': 11, 'min_split_loss': 3.0392194056411115, 'min_child_weight': 5.938805395280362, 'max_delta_step': 6.732961525337679, 'subsample': 0.6078028919724556, 'sampling_method': 'uniform', 'lambda': 5.269118474071856, 'grow_policy': 'lossguide', 'max_leaves': 0, 'max_bin': 129}. Best is trial 0 with value: 0.905041352516631.
[I 2023-07-13 07:05:59,456] Trial 4 finished with value: 0.930120903068269 and parameters: {'learning_rate': 0.7162242968279456, 'n_estimators': 1182, 'max_depth': 15, 'min_split_loss': 5.479645606356549, 'min_child_weight': 8.63870872862172, 'max_delta_step': 1.6433701199892758, 'subsample': 0.32050989008438446, 'sampling_method': 'gradient_based', 'lambda': 0.6290354687249877, 'grow_policy': 'depthwise', 'max_leaves': 9, 'max_bin': 219}. Best is trial 0 with value: 0.905041352516631.
[I 2023-07-13 07:07:35,056] Trial 5 finished with value: 0.9597636550502029 and parameters: {'learning_rate': 0.9800806625795399, 'n_estimators': 4205, 'max_depth': 6, 'min_split_loss': 17.560777216318606, 'min_child_weight': 8.634540534078205, 'max_delta_step': 2.2382594811501466, 'subsample': 0.5442397866324828, 'sampling_method': 'gradient_based', 'lambda': 2.3193081326592035, 'grow_policy': 'lossguide', 'max_leaves': 9, 'max_bin': 10}. Best is trial 0 with value: 0.905041352516631.
[I 2023-07-13 07:08:20,943] Trial 6 finished with value: 0.8872994058450085 and parameters: {'learning_rate': 0.09665947196377492, 'n_estimators': 3989, 'max_depth': 8, 'min_split_loss': 0.4242855840955384, 'min_child_weight': 2.83907311839638, 'max_delta_step': 0.12014380884933895, 'subsample': 0.9005286996241463, 'sampling_method': 'uniform', 'lambda': 1.5579883806833617, 'grow_policy': 'depthwise', 'max_leaves': 9, 'max_bin': 172}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:09:57,832] Trial 7 finished with value: 0.9103284019488257 and parameters: {'learning_rate': 0.9942488064545137, 'n_estimators': 5962, 'max_depth': 2, 'min_split_loss': 5.797649883028733, 'min_child_weight': 0.13059086371960404, 'max_delta_step': 4.880422851043765, 'subsample': 0.6831105899258559, 'sampling_method': 'uniform', 'lambda': 19.457410821980762, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 149}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:13:04,748] Trial 8 finished with value: 0.9439303467282677 and parameters: {'learning_rate': 0.10297180307052868, 'n_estimators': 6096, 'max_depth': 17, 'min_split_loss': 14.24231802169556, 'min_child_weight': 16.642014014335814, 'max_delta_step': 8.212236949522723, 'subsample': 0.7964334829150576, 'sampling_method': 'gradient_based', 'lambda': 3.0236697199281526, 'grow_policy': 'lossguide', 'max_leaves': 4, 'max_bin': 254}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:16:35,661] Trial 9 finished with value: 0.9218146074602874 and parameters: {'learning_rate': 0.5810258597453188, 'n_estimators': 6952, 'max_depth': 6, 'min_split_loss': 11.025701603509223, 'min_child_weight': 19.563826689792837, 'max_delta_step': 7.167389079341897, 'subsample': 0.31725701106414417, 'sampling_method': 'gradient_based', 'lambda': 5.605126993415109, 'grow_policy': 'lossguide', 'max_leaves': 0, 'max_bin': 40}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:16:53,714] Trial 10 finished with value: 0.9055264910645461 and parameters: {'learning_rate': 0.047371045622740963, 'n_estimators': 2040, 'max_depth': 20, 'min_split_loss': 1.010056319462079, 'min_child_weight': 1.8803746979126519, 'max_delta_step': 0.10802028345194792, 'subsample': 0.992715098064638, 'sampling_method': 'uniform', 'lambda': 11.791886604989001, 'grow_policy': 'depthwise', 'max_leaves': 20, 'max_bin': 179}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:18:15,498] Trial 11 finished with value: 0.8940121221048581 and parameters: {'learning_rate': 0.2520127009695552, 'n_estimators': 7690, 'max_depth': 14, 'min_split_loss': 0.14982406157345146, 'min_child_weight': 4.834986416685503, 'max_delta_step': 9.920399255270311, 'subsample': 0.967955567916853, 'sampling_method': 'uniform', 'lambda': 11.450670385115995, 'grow_policy': 'depthwise', 'max_leaves': 6, 'max_bin': 89}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:18:48,436] Trial 12 finished with value: 0.8993029207263307 and parameters: {'learning_rate': 0.2196712258088755, 'n_estimators': 3085, 'max_depth': 7, 'min_split_loss': 0.07308820234568747, 'min_child_weight': 3.98791667495166, 'max_delta_step': 9.793768487878769, 'subsample': 0.9818436569797179, 'sampling_method': 'uniform', 'lambda': 9.461355992812631, 'grow_policy': 'depthwise', 'max_leaves': 5, 'max_bin': 110}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:18:48,683] Trial 13 finished with value: 3.2017297422340305 and parameters: {'learning_rate': 0.016929407229984025, 'n_estimators': 3, 'max_depth': 0, 'min_split_loss': 0.19672708988076762, 'min_child_weight': 4.595276338091676, 'max_delta_step': 3.2980766439689484, 'subsample': 0.8820787259449075, 'sampling_method': 'uniform', 'lambda': 10.891296647955363, 'grow_policy': 'depthwise', 'max_leaves': 6, 'max_bin': 174}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:21:00,332] Trial 14 finished with value: 0.9254276222913985 and parameters: {'learning_rate': 0.20289376425654354, 'n_estimators': 7990, 'max_depth': 14, 'min_split_loss': 7.740239068573801, 'min_child_weight': 3.0251430796236476, 'max_delta_step': 9.673062655240136, 'subsample': 0.8913180035830367, 'sampling_method': 'uniform', 'lambda': 8.146558249759408, 'grow_policy': 'depthwise', 'max_leaves': 13, 'max_bin': 72}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:21:59,075] Trial 15 finished with value: 0.9398496871256501 and parameters: {'learning_rate': 0.33703707928949833, 'n_estimators': 5078, 'max_depth': 19, 'min_split_loss': 2.5061081748759584, 'min_child_weight': 0.20436990445654724, 'max_delta_step': 3.2591147107208345, 'subsample': 0.11255053825474748, 'sampling_method': 'uniform', 'lambda': 13.299831125392464, 'grow_policy': 'depthwise', 'max_leaves': 7, 'max_bin': 188}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:22:34,304] Trial 16 finished with value: 0.9482205781274523 and parameters: {'learning_rate': 0.18449250840658576, 'n_estimators': 2527, 'max_depth': 9, 'min_split_loss': 6.062311795099302, 'min_child_weight': 5.932424611337851, 'max_delta_step': 5.792076266817671, 'subsample': 0.996703446519078, 'sampling_method': 'uniform', 'lambda': 14.110792855564517, 'grow_policy': 'depthwise', 'max_leaves': 3, 'max_bin': 142}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:23:32,470] Trial 17 finished with value: 0.8933146221621223 and parameters: {'learning_rate': 0.12331988443577119, 'n_estimators': 5312, 'max_depth': 4, 'min_split_loss': 2.3539161612104986, 'min_child_weight': 2.3457395816763618, 'max_delta_step': 8.263160741624104, 'subsample': 0.7529073745381539, 'sampling_method': 'uniform', 'lambda': 8.120520608173077, 'grow_policy': 'depthwise', 'max_leaves': 13, 'max_bin': 217}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:26:02,130] Trial 18 finished with value: 0.9191634960334298 and parameters: {'learning_rate': 0.08797142804070068, 'n_estimators': 4903, 'max_depth': 3, 'min_split_loss': 3.201892245615812, 'min_child_weight': 2.123448296249606, 'max_delta_step': 1.3707812263887915, 'subsample': 0.7459305483718186, 'sampling_method': 'gradient_based', 'lambda': 0.38350737816630764, 'grow_policy': 'depthwise', 'max_leaves': 14, 'max_bin': 222}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:26:38,746] Trial 19 finished with value: 0.9358728205745391 and parameters: {'learning_rate': 0.009551215945535346, 'n_estimators': 3955, 'max_depth': 3, 'min_split_loss': 10.666262211819962, 'min_child_weight': 10.658070523228359, 'max_delta_step': 2.7656464736132107, 'subsample': 0.8763199071707838, 'sampling_method': 'uniform', 'lambda': 7.375101884200401, 'grow_policy': 'depthwise', 'max_leaves': 19, 'max_bin': 215}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:28:19,027] Trial 20 finished with value: 0.9141122585866419 and parameters: {'learning_rate': 0.3905938958430242, 'n_estimators': 5720, 'max_depth': 7, 'min_split_loss': 7.319066362442204, 'min_child_weight': 2.1595882932378636, 'max_delta_step': 4.006396329558563, 'subsample': 0.7592104915010207, 'sampling_method': 'uniform', 'lambda': 5.021922624808649, 'grow_policy': 'depthwise', 'max_leaves': 12, 'max_bin': 238}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:29:29,855] Trial 21 finished with value: 0.8976274553158292 and parameters: {'learning_rate': 0.15295267058945666, 'n_estimators': 3932, 'max_depth': 13, 'min_split_loss': 1.3971913602450492, 'min_child_weight': 5.107789203645682, 'max_delta_step': 8.691937959276345, 'subsample': 0.8839930541682451, 'sampling_method': 'uniform', 'lambda': 9.564366822558481, 'grow_policy': 'depthwise', 'max_leaves': 8, 'max_bin': 157}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:31:00,200] Trial 22 finished with value: 0.9001689771116383 and parameters: {'learning_rate': 0.2611610649117896, 'n_estimators': 7435, 'max_depth': 5, 'min_split_loss': 0.2004939214118603, 'min_child_weight': 3.558091115544813, 'max_delta_step': 8.761644643601375, 'subsample': 0.9040799130398032, 'sampling_method': 'uniform', 'lambda': 7.28384449754269, 'grow_policy': 'depthwise', 'max_leaves': 11, 'max_bin': 195}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:32:21,224] Trial 23 finished with value: 0.9350136324529232 and parameters: {'learning_rate': 0.12920398252564316, 'n_estimators': 5231, 'max_depth': 10, 'min_split_loss': 2.10444551327653, 'min_child_weight': 6.5167605288871195, 'max_delta_step': 7.646760671958557, 'subsample': 0.8187128172324835, 'sampling_method': 'uniform', 'lambda': 3.139952469025049, 'grow_policy': 'depthwise', 'max_leaves': 2, 'max_bin': 128}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:34:15,679] Trial 24 finished with value: 0.9002189018144637 and parameters: {'learning_rate': 0.266136501211877, 'n_estimators': 6469, 'max_depth': 0, 'min_split_loss': 3.7003978758097014, 'min_child_weight': 4.767123165519781, 'max_delta_step': 9.863007201495027, 'subsample': 0.7091988458157752, 'sampling_method': 'uniform', 'lambda': 11.710321742246869, 'grow_policy': 'depthwise', 'max_leaves': 15, 'max_bin': 105}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:35:32,768] Trial 25 finished with value: 0.9074523958768671 and parameters: {'learning_rate': 0.14056536104976508, 'n_estimators': 4362, 'max_depth': 17, 'min_split_loss': 1.7111424550985106, 'min_child_weight': 1.4036579899280213, 'max_delta_step': 6.926056043272346, 'subsample': 0.9233875379074893, 'sampling_method': 'uniform', 'lambda': 8.920649316546026, 'grow_policy': 'depthwise', 'max_leaves': 7, 'max_bin': 203}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:37:18,154] Trial 26 finished with value: 0.9254770245310734 and parameters: {'learning_rate': 0.08287415558273604, 'n_estimators': 3451, 'max_depth': 4, 'min_split_loss': 4.686717874364638, 'min_child_weight': 3.4940899891652752, 'max_delta_step': 8.878984884669798, 'subsample': 0.8281908159942887, 'sampling_method': 'gradient_based', 'lambda': 6.318673329285389, 'grow_policy': 'depthwise', 'max_leaves': 10, 'max_bin': 162}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:37:52,644] Trial 27 finished with value: 0.9061915639337595 and parameters: {'learning_rate': 0.20392582167074058, 'n_estimators': 1916, 'max_depth': 9, 'min_split_loss': 1.6306549974313054, 'min_child_weight': 0.9056731397542594, 'max_delta_step': 7.865403380401598, 'subsample': 0.9481492038127929, 'sampling_method': 'uniform', 'lambda': 10.302628708480619, 'grow_policy': 'depthwise', 'max_leaves': 18, 'max_bin': 77}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:39:04,978] Trial 28 finished with value: 0.9302071077071421 and parameters: {'learning_rate': 0.007153041931461518, 'n_estimators': 7347, 'max_depth': 8, 'min_split_loss': 4.455369312454647, 'min_child_weight': 3.2936583348163713, 'max_delta_step': 6.267223184162973, 'subsample': 0.9530595197619482, 'sampling_method': 'uniform', 'lambda': 7.837081770361687, 'grow_policy': 'depthwise', 'max_leaves': 5, 'max_bin': 244}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:41:21,087] Trial 29 finished with value: 0.9100844797554426 and parameters: {'learning_rate': 0.32596642184288993, 'n_estimators': 7877, 'max_depth': 16, 'min_split_loss': 3.2073292921617167, 'min_child_weight': 7.160093421379335, 'max_delta_step': 5.181751073733002, 'subsample': 0.858109706627041, 'sampling_method': 'uniform', 'lambda': 2.001166117453892, 'grow_policy': 'depthwise', 'max_leaves': 10, 'max_bin': 55}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:43:05,142] Trial 30 finished with value: 0.8993988768940081 and parameters: {'learning_rate': 0.091779258758552, 'n_estimators': 5420, 'max_depth': 11, 'min_split_loss': 2.1268365290563183, 'min_child_weight': 2.236482569465959, 'max_delta_step': 6.116276255790822, 'subsample': 0.7996447563362381, 'sampling_method': 'uniform', 'lambda': 4.125548105773229, 'grow_policy': 'depthwise', 'max_leaves': 8, 'max_bin': 130}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:44:16,517] Trial 31 finished with value: 0.8972770954908823 and parameters: {'learning_rate': 0.16327366194008355, 'n_estimators': 3732, 'max_depth': 13, 'min_split_loss': 1.0911617866374093, 'min_child_weight': 5.279418399928373, 'max_delta_step': 8.819690985874974, 'subsample': 0.919145212250547, 'sampling_method': 'uniform', 'lambda': 9.66829229710158, 'grow_policy': 'depthwise', 'max_leaves': 8, 'max_bin': 162}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:45:15,538] Trial 32 finished with value: 0.896178164723163 and parameters: {'learning_rate': 0.1800492987631787, 'n_estimators': 4440, 'max_depth': 13, 'min_split_loss': 0.8614143477815974, 'min_child_weight': 5.249639588162785, 'max_delta_step': 9.347055546943638, 'subsample': 0.9284498304053312, 'sampling_method': 'uniform', 'lambda': 6.881504752544877, 'grow_policy': 'depthwise', 'max_leaves': 11, 'max_bin': 98}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:46:05,944] Trial 33 finished with value: 0.8924328446833286 and parameters: {'learning_rate': 0.2588259309492744, 'n_estimators': 4698, 'max_depth': 12, 'min_split_loss': 0.2914181937577789, 'min_child_weight': 4.601027040987142, 'max_delta_step': 9.994722592846474, 'subsample': 0.9403070939808782, 'sampling_method': 'uniform', 'lambda': 6.435984275070366, 'grow_policy': 'depthwise', 'max_leaves': 12, 'max_bin': 87}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:46:31,689] Trial 34 finished with value: 0.8948431254433018 and parameters: {'learning_rate': 0.24871363560158188, 'n_estimators': 2931, 'max_depth': 11, 'min_split_loss': 0.0893748357580931, 'min_child_weight': 2.924906379958816, 'max_delta_step': 9.275426876218527, 'subsample': 0.9990499837085162, 'sampling_method': 'uniform', 'lambda': 6.073785452939367, 'grow_policy': 'depthwise', 'max_leaves': 13, 'max_bin': 85}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:47:44,839] Trial 35 finished with value: 0.91239646939918 and parameters: {'learning_rate': 0.2923918209348372, 'n_estimators': 4548, 'max_depth': 15, 'min_split_loss': 3.895468930107956, 'min_child_weight': 6.817670307497492, 'max_delta_step': 8.032708787495203, 'subsample': 0.8361659422132248, 'sampling_method': 'uniform', 'lambda': 4.334836767818527, 'grow_policy': 'depthwise', 'max_leaves': 14, 'max_bin': 56}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:49:20,875] Trial 36 finished with value: 0.9049649508649935 and parameters: {'learning_rate': 0.47741618931164703, 'n_estimators': 5553, 'max_depth': 12, 'min_split_loss': 2.166491476790093, 'min_child_weight': 1.02741929647012, 'max_delta_step': 9.85729381829567, 'subsample': 0.9430544633183455, 'sampling_method': 'uniform', 'lambda': 8.201682657945499, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 115}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:52:01,874] Trial 37 finished with value: 0.9271809396934609 and parameters: {'learning_rate': 0.34598042939564133, 'n_estimators': 6327, 'max_depth': 10, 'min_split_loss': 3.1440005941036686, 'min_child_weight': 8.264166851567808, 'max_delta_step': 7.524461699729365, 'subsample': 0.84537410530735, 'sampling_method': 'gradient_based', 'lambda': 6.3738866481465974, 'grow_policy': 'depthwise', 'max_leaves': 12, 'max_bin': 32}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:53:59,070] Trial 38 finished with value: 0.8991581945411788 and parameters: {'learning_rate': 0.24172780458549595, 'n_estimators': 6898, 'max_depth': 8, 'min_split_loss': 2.727617979139991, 'min_child_weight': 4.255905684278496, 'max_delta_step': 8.339585440112304, 'subsample': 0.7668263252393354, 'sampling_method': 'uniform', 'lambda': 1.0146242206475664, 'grow_policy': 'lossguide', 'max_leaves': 9, 'max_bin': 89}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:54:40,198] Trial 39 finished with value: 0.9090087702047638 and parameters: {'learning_rate': 0.12449728090515116, 'n_estimators': 3573, 'max_depth': 12, 'min_split_loss': 4.6656784051411275, 'min_child_weight': 0.10747120384235131, 'max_delta_step': 9.277244922537253, 'subsample': 0.6512422938433978, 'sampling_method': 'uniform', 'lambda': 3.9480939330234284, 'grow_policy': 'lossguide', 'max_leaves': 11, 'max_bin': 58}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:57:10,304] Trial 40 finished with value: 0.9215501627704384 and parameters: {'learning_rate': 0.06792951673098473, 'n_estimators': 4890, 'max_depth': 2, 'min_split_loss': 1.2122039847739199, 'min_child_weight': 9.858534936294358, 'max_delta_step': 0.7747491576749812, 'subsample': 0.791126840984298, 'sampling_method': 'gradient_based', 'lambda': 5.073731055894198, 'grow_policy': 'depthwise', 'max_leaves': 16, 'max_bin': 119}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:58:00,682] Trial 41 finished with value: 0.9048884384144872 and parameters: {'learning_rate': 0.2377381151088358, 'n_estimators': 2887, 'max_depth': 11, 'min_split_loss': 0.6157881600167431, 'min_child_weight': 2.608951314154683, 'max_delta_step': 9.366042616166247, 'subsample': 0.9883219450873838, 'sampling_method': 'uniform', 'lambda': 6.122968845839417, 'grow_policy': 'depthwise', 'max_leaves': 13, 'max_bin': 82}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:58:25,509] Trial 42 finished with value: 0.8941668118566998 and parameters: {'learning_rate': 0.39043851606272717, 'n_estimators': 2196, 'max_depth': 11, 'min_split_loss': 0.5124930581704101, 'min_child_weight': 3.823670691096704, 'max_delta_step': 9.938197744432582, 'subsample': 0.9449717527378574, 'sampling_method': 'uniform', 'lambda': 1.6260532336957638, 'grow_policy': 'depthwise', 'max_leaves': 13, 'max_bin': 100}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:58:35,462] Trial 43 finished with value: 0.9046628819991893 and parameters: {'learning_rate': 0.4051460814160721, 'n_estimators': 1104, 'max_depth': 14, 'min_split_loss': 1.3685565834685858, 'min_child_weight': 4.076824562581261, 'max_delta_step': 9.985211551517322, 'subsample': 0.9464733488613997, 'sampling_method': 'uniform', 'lambda': 1.5730353638017531, 'grow_policy': 'depthwise', 'max_leaves': 15, 'max_bin': 96}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:58:50,821] Trial 44 finished with value: 0.9048950312528097 and parameters: {'learning_rate': 0.29120494710325284, 'n_estimators': 1708, 'max_depth': 9, 'min_split_loss': 2.3444531863639546, 'min_child_weight': 6.2761785942089325, 'max_delta_step': 8.593191147934636, 'subsample': 0.861513826756117, 'sampling_method': 'uniform', 'lambda': 2.675788518241067, 'grow_policy': 'depthwise', 'max_leaves': 9, 'max_bin': 143}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:58:57,850] Trial 45 finished with value: 0.9000690613272491 and parameters: {'learning_rate': 0.44424874248967144, 'n_estimators': 549, 'max_depth': 6, 'min_split_loss': 0.10781225827262103, 'min_child_weight': 1.4461671506963993, 'max_delta_step': 8.223331799419752, 'subsample': 0.8989092287218059, 'sampling_method': 'uniform', 'lambda': 0.01943662454431916, 'grow_policy': 'depthwise', 'max_leaves': 12, 'max_bin': 67}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 07:59:59,722] Trial 46 finished with value: 0.8998469563505498 and parameters: {'learning_rate': 0.3643261491588836, 'n_estimators': 5980, 'max_depth': 15, 'min_split_loss': 1.3997049747696946, 'min_child_weight': 4.224973589438565, 'max_delta_step': 7.22367006530733, 'subsample': 0.9602119500089669, 'sampling_method': 'uniform', 'lambda': 2.989686016049269, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 122}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:00:35,660] Trial 47 finished with value: 0.9575103065097865 and parameters: {'learning_rate': 0.3004508640036708, 'n_estimators': 1476, 'max_depth': 10, 'min_split_loss': 3.0175057122744913, 'min_child_weight': 5.665684874372939, 'max_delta_step': 9.099453100058033, 'subsample': 0.9053420492457898, 'sampling_method': 'gradient_based', 'lambda': 1.4695159486101321, 'grow_policy': 'depthwise', 'max_leaves': 6, 'max_bin': 9}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:01:01,179] Trial 48 finished with value: 0.8907201946017309 and parameters: {'learning_rate': 0.20015386227421544, 'n_estimators': 2286, 'max_depth': 17, 'min_split_loss': 0.8583835733931595, 'min_child_weight': 2.8919806400965884, 'max_delta_step': 9.602950905107686, 'subsample': 0.8437960145267358, 'sampling_method': 'uniform', 'lambda': 0.8354468089064522, 'grow_policy': 'depthwise', 'max_leaves': 10, 'max_bin': 105}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:01:22,319] Trial 49 finished with value: 0.9159010658945412 and parameters: {'learning_rate': 0.041622928885471894, 'n_estimators': 2499, 'max_depth': 18, 'min_split_loss': 5.481682197191013, 'min_child_weight': 2.659049476154582, 'max_delta_step': 9.549885101556091, 'subsample': 0.7381044082432234, 'sampling_method': 'uniform', 'lambda': 2.3830713522057057, 'grow_policy': 'depthwise', 'max_leaves': 10, 'max_bin': 173}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:02:39,326] Trial 50 finished with value: 0.9062985031536087 and parameters: {'learning_rate': 0.20375733070718877, 'n_estimators': 4721, 'max_depth': 20, 'min_split_loss': 2.205175828404559, 'min_child_weight': 1.653233460402726, 'max_delta_step': 8.390239240562506, 'subsample': 0.7970029954353429, 'sampling_method': 'uniform', 'lambda': 0.6552795873581763, 'grow_policy': 'depthwise', 'max_leaves': 7, 'max_bin': 45}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:03:10,077] Trial 51 finished with value: 0.8902179190307752 and parameters: {'learning_rate': 0.16742155984404536, 'n_estimators': 2348, 'max_depth': 16, 'min_split_loss': 0.030400139573207086, 'min_child_weight': 3.324078794689364, 'max_delta_step': 9.558700275654736, 'subsample': 0.8697314195807353, 'sampling_method': 'uniform', 'lambda': 1.2518474623511506, 'grow_policy': 'depthwise', 'max_leaves': 11, 'max_bin': 103}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:03:47,299] Trial 52 finished with value: 0.8906449884238343 and parameters: {'learning_rate': 0.10814004606495894, 'n_estimators': 3094, 'max_depth': 16, 'min_split_loss': 0.05107701574360829, 'min_child_weight': 2.9055016725368854, 'max_delta_step': 9.340138634968108, 'subsample': 0.8593874425780857, 'sampling_method': 'uniform', 'lambda': 0.8899154744843792, 'grow_policy': 'depthwise', 'max_leaves': 11, 'max_bin': 106}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:04:15,328] Trial 53 finished with value: 0.8914460381009441 and parameters: {'learning_rate': 0.05988139838716107, 'n_estimators': 2521, 'max_depth': 17, 'min_split_loss': 0.8681908647442884, 'min_child_weight': 2.9940738253867227, 'max_delta_step': 9.082269684946406, 'subsample': 0.8507009417468436, 'sampling_method': 'uniform', 'lambda': 0.9161699499380183, 'grow_policy': 'depthwise', 'max_leaves': 11, 'max_bin': 137}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:04:47,955] Trial 54 finished with value: 0.8955604843043922 and parameters: {'learning_rate': 0.039768576249159165, 'n_estimators': 3192, 'max_depth': 18, 'min_split_loss': 1.0372112885445202, 'min_child_weight': 3.0666269595391444, 'max_delta_step': 9.181336376481946, 'subsample': 0.8590500589927815, 'sampling_method': 'uniform', 'lambda': 0.0687875497253505, 'grow_policy': 'depthwise', 'max_leaves': 11, 'max_bin': 135}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:05:19,100] Trial 55 finished with value: 0.8939337498514831 and parameters: {'learning_rate': 0.1571345538667101, 'n_estimators': 2502, 'max_depth': 17, 'min_split_loss': 0.08731118625313578, 'min_child_weight': 0.690855980955773, 'max_delta_step': 9.559089376151151, 'subsample': 0.835255089765705, 'sampling_method': 'uniform', 'lambda': 0.9788091120436264, 'grow_policy': 'depthwise', 'max_leaves': 9, 'max_bin': 108}. Best is trial 6 with value: 0.8872994058450085.
[I 2023-07-13 08:05:54,488] Trial 56 finished with value: 0.8841452194413219 and parameters: {'learning_rate': 0.10962281050630898, 'n_estimators': 2781, 'max_depth': 16, 'min_split_loss': 0.8157066445220137, 'min_child_weight': 1.8021446598232282, 'max_delta_step': 9.074574560828895, 'subsample': 0.877782570272007, 'sampling_method': 'uniform', 'lambda': 2.0046469193516345, 'grow_policy': 'lossguide', 'max_leaves': 11, 'max_bin': 145}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:06:26,339] Trial 57 finished with value: 0.8871065737397903 and parameters: {'learning_rate': 0.10279932799622625, 'n_estimators': 2780, 'max_depth': 16, 'min_split_loss': 0.9845244287117242, 'min_child_weight': 1.7834743701061702, 'max_delta_step': 9.024456295376394, 'subsample': 0.87502000884189, 'sampling_method': 'uniform', 'lambda': 2.1226230427760084, 'grow_policy': 'lossguide', 'max_leaves': 10, 'max_bin': 145}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:07:28,709] Trial 58 finished with value: 0.9135028068005472 and parameters: {'learning_rate': 0.10353364169317422, 'n_estimators': 2823, 'max_depth': 16, 'min_split_loss': 1.8206697297361942, 'min_child_weight': 1.772764447082947, 'max_delta_step': 8.559352811898739, 'subsample': 0.8748608009032851, 'sampling_method': 'gradient_based', 'lambda': 2.2269490682409514, 'grow_policy': 'lossguide', 'max_leaves': 9, 'max_bin': 148}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:07:48,029] Trial 59 finished with value: 0.9067876784478767 and parameters: {'learning_rate': 0.10119558869068745, 'n_estimators': 2166, 'max_depth': 19, 'min_split_loss': 3.861522556330089, 'min_child_weight': 0.6537310175423934, 'max_delta_step': 7.877209770717852, 'subsample': 0.7845498175771001, 'sampling_method': 'uniform', 'lambda': 3.2748176306434758, 'grow_policy': 'lossguide', 'max_leaves': 10, 'max_bin': 153}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:08:19,510] Trial 60 finished with value: 0.8924696245278053 and parameters: {'learning_rate': 0.16847703213037662, 'n_estimators': 3245, 'max_depth': 16, 'min_split_loss': 2.794796276887125, 'min_child_weight': 0.0023398596552366424, 'max_delta_step': 8.878100611528698, 'subsample': 0.7049082952825028, 'sampling_method': 'uniform', 'lambda': 1.7601813873378063, 'grow_policy': 'lossguide', 'max_leaves': 10, 'max_bin': 179}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:08:57,187] Trial 61 finished with value: 0.8862217676978554 and parameters: {'learning_rate': 0.05620036713984054, 'n_estimators': 2459, 'max_depth': 18, 'min_split_loss': 0.7529687689288, 'min_child_weight': 2.4843565977308253, 'max_delta_step': 9.560548132306455, 'subsample': 0.8785755033023603, 'sampling_method': 'uniform', 'lambda': 0.8647197218338531, 'grow_policy': 'lossguide', 'max_leaves': 11, 'max_bin': 141}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:09:32,967] Trial 62 finished with value: 0.8925701960398221 and parameters: {'learning_rate': 0.0433785550284383, 'n_estimators': 2703, 'max_depth': 18, 'min_split_loss': 0.8588742633746933, 'min_child_weight': 2.1269929515706263, 'max_delta_step': 9.605949332565505, 'subsample': 0.8891618309195928, 'sampling_method': 'uniform', 'lambda': 1.0432183817738947, 'grow_policy': 'lossguide', 'max_leaves': 8, 'max_bin': 168}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:10:45,982] Trial 63 finished with value: 0.9655741432065621 and parameters: {'learning_rate': 0.0008280489363634361, 'n_estimators': 4088, 'max_depth': 15, 'min_split_loss': 1.8488840016345383, 'min_child_weight': 1.2236425895548773, 'max_delta_step': 8.930489608939416, 'subsample': 0.8143388359770349, 'sampling_method': 'uniform', 'lambda': 0.35466307214400616, 'grow_policy': 'lossguide', 'max_leaves': 11, 'max_bin': 125}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:11:00,609] Trial 64 finished with value: 0.8966964496734434 and parameters: {'learning_rate': 0.11750374296134714, 'n_estimators': 1437, 'max_depth': 19, 'min_split_loss': 1.433321607039101, 'min_child_weight': 3.744582270362263, 'max_delta_step': 9.519486547315337, 'subsample': 0.9055032025889037, 'sampling_method': 'uniform', 'lambda': 2.6509086961550725, 'grow_policy': 'lossguide', 'max_leaves': 10, 'max_bin': 187}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:11:35,442] Trial 65 finished with value: 0.8866417044534007 and parameters: {'learning_rate': 0.07056074983959502, 'n_estimators': 2209, 'max_depth': 16, 'min_split_loss': 0.5743675388471856, 'min_child_weight': 2.4544901711066798, 'max_delta_step': 8.544700970230057, 'subsample': 0.816600147691608, 'sampling_method': 'uniform', 'lambda': 1.95298648038859, 'grow_policy': 'lossguide', 'max_leaves': 9, 'max_bin': 115}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:11:54,670] Trial 66 finished with value: 0.9004934202592745 and parameters: {'learning_rate': 0.0858934538257684, 'n_estimators': 1912, 'max_depth': 16, 'min_split_loss': 1.6865731700641322, 'min_child_weight': 1.9550775112722991, 'max_delta_step': 8.466248716072954, 'subsample': 0.8766479973743263, 'sampling_method': 'uniform', 'lambda': 3.553687711934903, 'grow_policy': 'lossguide', 'max_leaves': 8, 'max_bin': 147}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:12:31,607] Trial 67 finished with value: 0.8931824889415296 and parameters: {'learning_rate': 0.13975223771475698, 'n_estimators': 3802, 'max_depth': 19, 'min_split_loss': 0.6533629515600031, 'min_child_weight': 2.485846417387158, 'max_delta_step': 2.1097194095678606, 'subsample': 0.9709266501681528, 'sampling_method': 'uniform', 'lambda': 2.154966384298534, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 114}. Best is trial 56 with value: 0.8841452194413219.
[I 2023-07-13 08:13:30,509] Trial 68 finished with value: 0.8810733044878761 and parameters: {'learning_rate': 0.06448241268708507, 'n_estimators': 3565, 'max_depth': 18, 'min_split_loss': 0.1242624214180062, 'min_child_weight': 3.6009850526870277, 'max_delta_step': 8.679349868649131, 'subsample': 0.822004876547384, 'sampling_method': 'uniform', 'lambda': 1.5203556866014052, 'grow_policy': 'lossguide', 'max_leaves': 9, 'max_bin': 134}. Best is trial 68 with value: 0.8810733044878761.
[I 2023-07-13 08:14:04,247] Trial 69 finished with value: 0.9045449353128653 and parameters: {'learning_rate': 0.059156615726173464, 'n_estimators': 3486, 'max_depth': 14, 'min_split_loss': 2.5770303959194427, 'min_child_weight': 1.32322465707073, 'max_delta_step': 8.001471262158299, 'subsample': 0.8106601012486047, 'sampling_method': 'uniform', 'lambda': 2.776707325754769, 'grow_policy': 'lossguide', 'max_leaves': 7, 'max_bin': 136}. Best is trial 68 with value: 0.8810733044878761.
[I 2023-07-13 08:14:17,048] Trial 70 finished with value: 0.9194252260644772 and parameters: {'learning_rate': 0.023333690925781532, 'n_estimators': 977, 'max_depth': 18, 'min_split_loss': 3.4081774902270423, 'min_child_weight': 3.6584539079932843, 'max_delta_step': 8.638166301814506, 'subsample': 0.916106754348581, 'sampling_method': 'uniform', 'lambda': 3.4640440447076726, 'grow_policy': 'lossguide', 'max_leaves': 9, 'max_bin': 158}. Best is trial 68 with value: 0.8810733044878761.
[I 2023-07-13 08:15:14,463] Trial 71 finished with value: 0.87887419717144 and parameters: {'learning_rate': 0.0741618679198387, 'n_estimators': 3193, 'max_depth': 16, 'min_split_loss': 0.5345134504074599, 'min_child_weight': 3.475968245459725, 'max_delta_step': 8.924346043694053, 'subsample': 0.8210477330395755, 'sampling_method': 'uniform', 'lambda': 1.479107893264774, 'grow_policy': 'lossguide', 'max_leaves': 11, 'max_bin': 128}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:16:02,042] Trial 72 finished with value: 0.8809988578926667 and parameters: {'learning_rate': 0.0736647162245811, 'n_estimators': 2708, 'max_depth': 20, 'min_split_loss': 0.8719084054717368, 'min_child_weight': 4.561874671708541, 'max_delta_step': 8.95947653168879, 'subsample': 0.7724627682519857, 'sampling_method': 'uniform', 'lambda': 1.8106217893736294, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 127}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:16:44,602] Trial 73 finished with value: 0.8867148683303437 and parameters: {'learning_rate': 0.06745087085430967, 'n_estimators': 3642, 'max_depth': 20, 'min_split_loss': 1.7434495581193796, 'min_child_weight': 4.610135653988148, 'max_delta_step': 8.247166285862539, 'subsample': 0.7676326369662533, 'sampling_method': 'uniform', 'lambda': 2.0804934400528685, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 142}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:17:25,893] Trial 74 finished with value: 0.8919814079290846 and parameters: {'learning_rate': 0.028980812147176585, 'n_estimators': 2712, 'max_depth': 20, 'min_split_loss': 1.5304078528863094, 'min_child_weight': 4.671023700807218, 'max_delta_step': 8.955955522149482, 'subsample': 0.7793382102164056, 'sampling_method': 'uniform', 'lambda': 1.900493828605303, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 129}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:18:04,094] Trial 75 finished with value: 0.8949435933188795 and parameters: {'learning_rate': 0.06510785251596743, 'n_estimators': 3655, 'max_depth': 20, 'min_split_loss': 2.619719797967364, 'min_child_weight': 5.588040296483834, 'max_delta_step': 8.154712931831561, 'subsample': 0.7589522098175205, 'sampling_method': 'uniform', 'lambda': 4.595291276447938, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 139}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:19:16,789] Trial 76 finished with value: 0.9172092114308465 and parameters: {'learning_rate': 0.0028821410883413112, 'n_estimators': 3292, 'max_depth': 19, 'min_split_loss': 0.6715152151316253, 'min_child_weight': 4.660542949888493, 'max_delta_step': 7.716234005280416, 'subsample': 0.818078490147379, 'sampling_method': 'uniform', 'lambda': 2.357808604597836, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 153}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:20:15,629] Trial 77 finished with value: 0.9088265089027743 and parameters: {'learning_rate': 0.07427603701949555, 'n_estimators': 2975, 'max_depth': 18, 'min_split_loss': 1.9837120763035174, 'min_child_weight': 2.173209049231952, 'max_delta_step': 8.732110122906919, 'subsample': 0.8178299688146424, 'sampling_method': 'gradient_based', 'lambda': 3.9098729098937577, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 166}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:21:12,043] Trial 78 finished with value: 0.8856581834680093 and parameters: {'learning_rate': 0.14666122990020886, 'n_estimators': 4205, 'max_depth': 20, 'min_split_loss': 1.1147232647702108, 'min_child_weight': 5.076116861571264, 'max_delta_step': 8.443537090117871, 'subsample': 0.7329822062656423, 'sampling_method': 'uniform', 'lambda': 1.7389572145449559, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 120}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:22:03,604] Trial 79 finished with value: 0.8855283943618784 and parameters: {'learning_rate': 0.14994283459908592, 'n_estimators': 4295, 'max_depth': 19, 'min_split_loss': 1.344673846644707, 'min_child_weight': 5.227350739858304, 'max_delta_step': 8.363916618120392, 'subsample': 0.7363495458857823, 'sampling_method': 'uniform', 'lambda': 1.4013916805981093, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 119}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:23:13,204] Trial 80 finished with value: 1.347736950246858 and parameters: {'learning_rate': 0.13942829617530458, 'n_estimators': 4245, 'max_depth': 19, 'min_split_loss': 0.6207698689988989, 'min_child_weight': 5.136395399541685, 'max_delta_step': 8.478144559974584, 'subsample': 0.7420023851341795, 'sampling_method': 'uniform', 'lambda': 0.4760589621879687, 'grow_policy': 'lossguide', 'max_leaves': 1, 'max_bin': 131}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:24:14,087] Trial 81 finished with value: 0.8856129946486911 and parameters: {'learning_rate': 0.03859688192139647, 'n_estimators': 4187, 'max_depth': 20, 'min_split_loss': 1.5245216142278908, 'min_child_weight': 4.13737774099251, 'max_delta_step': 8.241796993497962, 'subsample': 0.7236492411648316, 'sampling_method': 'uniform', 'lambda': 1.7351226824862287, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 118}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:25:25,472] Trial 82 finished with value: 0.8837594899145971 and parameters: {'learning_rate': 0.029568467624029968, 'n_estimators': 4046, 'max_depth': 20, 'min_split_loss': 1.2772733307505917, 'min_child_weight': 5.972098886709113, 'max_delta_step': 7.442575338232615, 'subsample': 0.7175519434260389, 'sampling_method': 'uniform', 'lambda': 1.4321135326890326, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 118}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:26:41,182] Trial 83 finished with value: 0.8819360232800555 and parameters: {'learning_rate': 0.028972197929259563, 'n_estimators': 4066, 'max_depth': 20, 'min_split_loss': 1.1739849574055279, 'min_child_weight': 3.980513369074275, 'max_delta_step': 7.452782826884524, 'subsample': 0.6892783066211237, 'sampling_method': 'uniform', 'lambda': 1.408724447592029, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 122}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:27:31,816] Trial 84 finished with value: 0.8926292567079571 and parameters: {'learning_rate': 0.031698157182505196, 'n_estimators': 3993, 'max_depth': 20, 'min_split_loss': 2.1691552002322343, 'min_child_weight': 5.98662041183024, 'max_delta_step': 7.504563839707242, 'subsample': 0.7233557700318521, 'sampling_method': 'uniform', 'lambda': 1.458366230850093, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 121}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:28:34,082] Trial 85 finished with value: 0.8888508673029001 and parameters: {'learning_rate': 0.1326726117229031, 'n_estimators': 4246, 'max_depth': 20, 'min_split_loss': 1.2482951213988505, 'min_child_weight': 4.270314301617676, 'max_delta_step': 7.870908694138121, 'subsample': 0.6548256915767328, 'sampling_method': 'uniform', 'lambda': 3.127493380788213, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 112}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:29:23,277] Trial 86 finished with value: 0.8969650635695992 and parameters: {'learning_rate': 0.022377613672654457, 'n_estimators': 3870, 'max_depth': 19, 'min_split_loss': 2.8348562368611145, 'min_child_weight': 6.094446358618332, 'max_delta_step': 7.325963307270894, 'subsample': 0.697445597771739, 'sampling_method': 'uniform', 'lambda': 1.4069617073656073, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 120}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:30:04,210] Trial 87 finished with value: 0.8998063738710547 and parameters: {'learning_rate': 0.09279848254747913, 'n_estimators': 4500, 'max_depth': 19, 'min_split_loss': 3.6090373864954546, 'min_child_weight': 5.163296046619743, 'max_delta_step': 6.9063796267770226, 'subsample': 0.726707870615855, 'sampling_method': 'uniform', 'lambda': 0.36033466023243577, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 127}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:30:39,190] Trial 88 finished with value: 0.8924236987838636 and parameters: {'learning_rate': 0.1784274904228006, 'n_estimators': 3404, 'max_depth': 20, 'min_split_loss': 2.4746439838381766, 'min_child_weight': 6.717585706078218, 'max_delta_step': 8.162296499850099, 'subsample': 0.67343882490667, 'sampling_method': 'uniform', 'lambda': 2.9393722653000465, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 94}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:32:47,697] Trial 89 finished with value: 0.89968393508508 and parameters: {'learning_rate': 0.12392169772514736, 'n_estimators': 5067, 'max_depth': 19, 'min_split_loss': 1.4236707927990633, 'min_child_weight': 4.029158187985857, 'max_delta_step': 7.739842540466993, 'subsample': 0.7227251337611978, 'sampling_method': 'gradient_based', 'lambda': 0.012535561708473253, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 132}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:33:25,844] Trial 90 finished with value: 0.9079886666715549 and parameters: {'learning_rate': 0.04119802918826648, 'n_estimators': 4124, 'max_depth': 20, 'min_split_loss': 4.3001362326641885, 'min_child_weight': 5.719246413266698, 'max_delta_step': 8.074475935898963, 'subsample': 0.7516751147463373, 'sampling_method': 'uniform', 'lambda': 1.4119949451829925, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 111}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:34:56,029] Trial 91 finished with value: 0.8795062875232112 and parameters: {'learning_rate': 0.052101423333593175, 'n_estimators': 4366, 'max_depth': 18, 'min_split_loss': 0.40267093857479186, 'min_child_weight': 3.4893467099725046, 'max_delta_step': 8.82910399183132, 'subsample': 0.7858488699889873, 'sampling_method': 'uniform', 'lambda': 2.6791092853754668, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 124}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:36:30,650] Trial 92 finished with value: 0.890111835198004 and parameters: {'learning_rate': 0.012009338283537896, 'n_estimators': 4668, 'max_depth': 17, 'min_split_loss': 0.3373283219668815, 'min_child_weight': 3.7814853383013745, 'max_delta_step': 8.790283703287578, 'subsample': 0.68707435642402, 'sampling_method': 'uniform', 'lambda': 2.497331857508863, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 122}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:37:32,082] Trial 93 finished with value: 0.8833959722767201 and parameters: {'learning_rate': 0.09106955849545503, 'n_estimators': 5079, 'max_depth': 18, 'min_split_loss': 1.2469835998357, 'min_child_weight': 3.3683874275119114, 'max_delta_step': 8.34115239305792, 'subsample': 0.7834220976990718, 'sampling_method': 'uniform', 'lambda': 1.6739649248342003, 'grow_policy': 'lossguide', 'max_leaves': 12, 'max_bin': 117}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:38:23,995] Trial 94 finished with value: 0.888636959553098 and parameters: {'learning_rate': 0.0896607729191021, 'n_estimators': 5014, 'max_depth': 18, 'min_split_loss': 1.9688071809010836, 'min_child_weight': 3.331306617107165, 'max_delta_step': 7.429886794357724, 'subsample': 0.7823449656823362, 'sampling_method': 'uniform', 'lambda': 1.1777393369445683, 'grow_policy': 'lossguide', 'max_leaves': 11, 'max_bin': 126}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:39:16,217] Trial 95 finished with value: 0.883640605765251 and parameters: {'learning_rate': 0.11511288708266718, 'n_estimators': 4349, 'max_depth': 18, 'min_split_loss': 1.3588990853382836, 'min_child_weight': 3.5813357659477716, 'max_delta_step': 9.202408571574525, 'subsample': 0.7732187336132982, 'sampling_method': 'uniform', 'lambda': 2.6999831518045054, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 116}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:40:55,758] Trial 96 finished with value: 0.8915349776656137 and parameters: {'learning_rate': 0.11840798630230832, 'n_estimators': 4475, 'max_depth': 18, 'min_split_loss': 0.3868236824462324, 'min_child_weight': 3.221511261265929, 'max_delta_step': 9.181902830078856, 'subsample': 0.7554531577514975, 'sampling_method': 'uniform', 'lambda': 3.5633258331282076, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 135}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:41:49,045] Trial 97 finished with value: 0.9008047867814424 and parameters: {'learning_rate': 0.05628468000337464, 'n_estimators': 5522, 'max_depth': 17, 'min_split_loss': 2.980431895136631, 'min_child_weight': 3.6823648359554455, 'max_delta_step': 9.044683271617131, 'subsample': 0.7951615503326078, 'sampling_method': 'uniform', 'lambda': 2.73835702930739, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 103}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:42:51,104] Trial 98 finished with value: 0.8815872756748206 and parameters: {'learning_rate': 0.0856592420453076, 'n_estimators': 4845, 'max_depth': 17, 'min_split_loss': 1.2483374787474062, 'min_child_weight': 4.4619988139638505, 'max_delta_step': 7.086353702043658, 'subsample': 0.7855711612065092, 'sampling_method': 'uniform', 'lambda': 0.4894068560549084, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 110}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:44:59,653] Trial 99 finished with value: 0.8934197819425241 and parameters: {'learning_rate': 0.08489524002243279, 'n_estimators': 4761, 'max_depth': 17, 'min_split_loss': 0.03189170955294157, 'min_child_weight': 4.341255344340944, 'max_delta_step': 7.082749338366523, 'subsample': 0.7709921465715756, 'sampling_method': 'uniform', 'lambda': 0.6949995602674235, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 99}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:46:40,373] Trial 100 finished with value: 0.882411449188867 and parameters: {'learning_rate': 0.022006069960913262, 'n_estimators': 5355, 'max_depth': 17, 'min_split_loss': 1.0191098431060444, 'min_child_weight': 2.884212450879025, 'max_delta_step': 6.507434677264211, 'subsample': 0.7987853536401942, 'sampling_method': 'uniform', 'lambda': 2.379500700612513, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 109}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:48:59,017] Trial 101 finished with value: 0.9021228489918283 and parameters: {'learning_rate': 0.003179745979045301, 'n_estimators': 5415, 'max_depth': 17, 'min_split_loss': 1.0552504331534789, 'min_child_weight': 3.5802692708134227, 'max_delta_step': 7.514829833798536, 'subsample': 0.8398485336100387, 'sampling_method': 'uniform', 'lambda': 2.2836412910573016, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 92}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:50:08,510] Trial 102 finished with value: 0.894389531227759 and parameters: {'learning_rate': 0.024429594247526904, 'n_estimators': 5825, 'max_depth': 15, 'min_split_loss': 2.2681468299717946, 'min_child_weight': 2.8150226926294852, 'max_delta_step': 7.192436172443635, 'subsample': 0.800242552043852, 'sampling_method': 'uniform', 'lambda': 2.6001752058685152, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 113}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:51:40,487] Trial 103 finished with value: 0.89065261798095 and parameters: {'learning_rate': 0.10986566638806834, 'n_estimators': 5189, 'max_depth': 18, 'min_split_loss': 0.4935211475678538, 'min_child_weight': 3.1107379519324296, 'max_delta_step': 6.679070891200401, 'subsample': 0.8301231452011004, 'sampling_method': 'uniform', 'lambda': 0.47435596653159595, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 80}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:52:36,766] Trial 104 finished with value: 0.8857052475004228 and parameters: {'learning_rate': 0.07279477913231953, 'n_estimators': 4938, 'max_depth': 18, 'min_split_loss': 1.7782619306926657, 'min_child_weight': 3.510757638565423, 'max_delta_step': 8.715033497004438, 'subsample': 0.7748300909586056, 'sampling_method': 'uniform', 'lambda': 3.1709275659541216, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 107}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:53:52,245] Trial 105 finished with value: 0.8792416840979114 and parameters: {'learning_rate': 0.048390339052886346, 'n_estimators': 4602, 'max_depth': 17, 'min_split_loss': 0.9192546809654096, 'min_child_weight': 4.335582566334082, 'max_delta_step': 7.786687964223332, 'subsample': 0.8001856303484566, 'sampling_method': 'uniform', 'lambda': 1.2291910635922285, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 126}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:55:25,533] Trial 106 finished with value: 0.8824655642161485 and parameters: {'learning_rate': 0.023732595751756166, 'n_estimators': 5215, 'max_depth': 17, 'min_split_loss': 1.0731905312662282, 'min_child_weight': 4.444419485997287, 'max_delta_step': 7.610636660599713, 'subsample': 0.7994003330613938, 'sampling_method': 'uniform', 'lambda': 0.9889708985701491, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 127}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 08:57:22,322] Trial 107 finished with value: 0.879237744406921 and parameters: {'learning_rate': 0.05135713174919806, 'n_estimators': 4647, 'max_depth': 17, 'min_split_loss': 0.386834823025075, 'min_child_weight': 4.361236443101365, 'max_delta_step': 7.8579750077061075, 'subsample': 0.7929323268382169, 'sampling_method': 'uniform', 'lambda': 1.0889287985405693, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 125}. Best is trial 71 with value: 0.87887419717144.
[I 2023-07-13 09:00:32,035] Trial 108 finished with value: 0.8774090434127533 and parameters: {'learning_rate': 0.04463015423728046, 'n_estimators': 5295, 'max_depth': 17, 'min_split_loss': 0.004100401237421267, 'min_child_weight': 4.3999257016711075, 'max_delta_step': 7.768211315690294, 'subsample': 0.8001858255587984, 'sampling_method': 'gradient_based', 'lambda': 0.6868756710267785, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 131}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:03:51,859] Trial 109 finished with value: 0.9169287285956251 and parameters: {'learning_rate': 0.0014366415042332027, 'n_estimators': 6206, 'max_depth': 17, 'min_split_loss': 0.050257911921962176, 'min_child_weight': 4.929179516926244, 'max_delta_step': 7.688893421065701, 'subsample': 0.7986133921428045, 'sampling_method': 'gradient_based', 'lambda': 0.684932960079228, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 125}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:06:16,312] Trial 110 finished with value: 0.8929660426632452 and parameters: {'learning_rate': 0.050937512748855995, 'n_estimators': 5658, 'max_depth': 17, 'min_split_loss': 0.5707113486006027, 'min_child_weight': 4.412892766822003, 'max_delta_step': 7.89793197690084, 'subsample': 0.8337690052727561, 'sampling_method': 'gradient_based', 'lambda': 0.2603329254502378, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 133}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:08:32,246] Trial 111 finished with value: 0.8852019494657991 and parameters: {'learning_rate': 0.047332134879079966, 'n_estimators': 5238, 'max_depth': 17, 'min_split_loss': 0.43879267344761574, 'min_child_weight': 4.105276166103302, 'max_delta_step': 7.685893313319754, 'subsample': 0.7998269447888839, 'sampling_method': 'gradient_based', 'lambda': 1.1027670418246491, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 153}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:10:23,352] Trial 112 finished with value: 0.8962686022495827 and parameters: {'learning_rate': 0.0783804619802232, 'n_estimators': 4611, 'max_depth': 15, 'min_split_loss': 1.0710489732844932, 'min_child_weight': 4.833418450925835, 'max_delta_step': 8.105374891361, 'subsample': 0.7503450829165332, 'sampling_method': 'gradient_based', 'lambda': 0.6860521466837933, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 129}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:12:24,402] Trial 113 finished with value: 0.8898408886171645 and parameters: {'learning_rate': 0.05052870199336519, 'n_estimators': 4831, 'max_depth': 16, 'min_split_loss': 0.38372716264470563, 'min_child_weight': 3.9392903120273317, 'max_delta_step': 7.961463603193876, 'subsample': 0.8450535946186724, 'sampling_method': 'gradient_based', 'lambda': 1.101942194036265, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 139}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:13:35,765] Trial 114 finished with value: 0.880219542166056 and parameters: {'learning_rate': 0.08993820775381682, 'n_estimators': 5154, 'max_depth': 17, 'min_split_loss': 0.9084673764005619, 'min_child_weight': 5.43112856950318, 'max_delta_step': 7.241618475656329, 'subsample': 0.8156503071992549, 'sampling_method': 'uniform', 'lambda': 0.0306883571829506, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 110}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:15:19,971] Trial 115 finished with value: 0.8821202662338969 and parameters: {'learning_rate': 0.020424130788252986, 'n_estimators': 5317, 'max_depth': 16, 'min_split_loss': 0.8699343950552174, 'min_child_weight': 4.538731069839138, 'max_delta_step': 6.624422383432769, 'subsample': 0.8186852139018193, 'sampling_method': 'uniform', 'lambda': 0.0901936801562433, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 107}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:17:52,364] Trial 116 finished with value: 0.8921685482600346 and parameters: {'learning_rate': 0.06978745320892217, 'n_estimators': 5369, 'max_depth': 15, 'min_split_loss': 0.026181193856184226, 'min_child_weight': 5.420853315510473, 'max_delta_step': 6.788500604923512, 'subsample': 0.8287531313306484, 'sampling_method': 'uniform', 'lambda': 0.05448681951472567, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 109}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:18:59,851] Trial 117 finished with value: 0.8962621327515243 and parameters: {'learning_rate': 0.028320373661615283, 'n_estimators': 5870, 'max_depth': 16, 'min_split_loss': 1.8492001906345368, 'min_child_weight': 5.602404829294088, 'max_delta_step': 7.338718440862498, 'subsample': 0.8525855228538841, 'sampling_method': 'uniform', 'lambda': 0.4123123209306301, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 100}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:21:23,551] Trial 118 finished with value: 0.8949034318639371 and parameters: {'learning_rate': 0.049904150503904524, 'n_estimators': 5542, 'max_depth': 14, 'min_split_loss': 0.8518335566565826, 'min_child_weight': 4.773128571188258, 'max_delta_step': 6.517979116243756, 'subsample': 0.7615786466019777, 'sampling_method': 'gradient_based', 'lambda': 0.5502152986783266, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 109}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:22:10,088] Trial 119 finished with value: 0.8948383385075843 and parameters: {'learning_rate': 0.08775414353611619, 'n_estimators': 4869, 'max_depth': 16, 'min_split_loss': 2.3571258660570216, 'min_child_weight': 6.396914036462153, 'max_delta_step': 6.617273511054241, 'subsample': 0.8163747412220448, 'sampling_method': 'uniform', 'lambda': 1.2262806732908076, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 88}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:23:53,281] Trial 120 finished with value: 0.9909418333537785 and parameters: {'learning_rate': 0.0005802013112252494, 'n_estimators': 4583, 'max_depth': 17, 'min_split_loss': 1.7831766228626469, 'min_child_weight': 2.664186566067767, 'max_delta_step': 7.048142584135079, 'subsample': 0.8182926342686339, 'sampling_method': 'uniform', 'lambda': 1.8889746918437045, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 124}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:25:42,103] Trial 121 finished with value: 0.8803605477253811 and parameters: {'learning_rate': 0.02075948445669937, 'n_estimators': 5199, 'max_depth': 17, 'min_split_loss': 0.8813416731138072, 'min_child_weight': 4.44919874541044, 'max_delta_step': 7.194965380368376, 'subsample': 0.8000887071887467, 'sampling_method': 'uniform', 'lambda': 0.8460169566129164, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 131}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:26:56,725] Trial 122 finished with value: 0.879474201997061 and parameters: {'learning_rate': 0.06815153526976993, 'n_estimators': 5129, 'max_depth': 17, 'min_split_loss': 0.7339557700890957, 'min_child_weight': 3.9986661359787417, 'max_delta_step': 6.997720461450683, 'subsample': 0.8608392787921908, 'sampling_method': 'uniform', 'lambda': 0.0461853315002827, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 132}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:28:37,006] Trial 123 finished with value: 0.878548970915117 and parameters: {'learning_rate': 0.0653554369733202, 'n_estimators': 5741, 'max_depth': 18, 'min_split_loss': 0.4856937847123207, 'min_child_weight': 4.501610242225171, 'max_delta_step': 6.976372462056431, 'subsample': 0.8655684137138924, 'sampling_method': 'uniform', 'lambda': 0.08428026165997621, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 134}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:30:35,693] Trial 124 finished with value: 0.8813120801499922 and parameters: {'learning_rate': 0.07201447146262986, 'n_estimators': 5693, 'max_depth': 19, 'min_split_loss': 0.3737451928960992, 'min_child_weight': 3.991977529451075, 'max_delta_step': 7.007399073048354, 'subsample': 0.8507719154404754, 'sampling_method': 'uniform', 'lambda': 0.5701947297235679, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 138}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:32:20,213] Trial 125 finished with value: 0.8823818990510647 and parameters: {'learning_rate': 0.10170889133166691, 'n_estimators': 6013, 'max_depth': 19, 'min_split_loss': 0.41520535888930643, 'min_child_weight': 5.399458833020197, 'max_delta_step': 6.994906030121884, 'subsample': 0.8598624419665266, 'sampling_method': 'uniform', 'lambda': 0.5978854768389775, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 150}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:33:34,944] Trial 126 finished with value: 0.8834982157275256 and parameters: {'learning_rate': 0.13196186001427843, 'n_estimators': 5691, 'max_depth': 18, 'min_split_loss': 0.5169320120687773, 'min_child_weight': 4.920185454740702, 'max_delta_step': 7.175824466789544, 'subsample': 0.886940585088982, 'sampling_method': 'uniform', 'lambda': 0.04884855468996818, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 138}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:36:04,151] Trial 127 finished with value: 0.8865471244380381 and parameters: {'learning_rate': 0.07256046721848138, 'n_estimators': 6162, 'max_depth': 18, 'min_split_loss': 0.1036710083861162, 'min_child_weight': 4.186356973773006, 'max_delta_step': 7.255568904402319, 'subsample': 0.8501660822900159, 'sampling_method': 'uniform', 'lambda': 0.8608512611346983, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 133}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:37:20,541] Trial 128 finished with value: 0.8809950174275976 and parameters: {'learning_rate': 0.15956121722909944, 'n_estimators': 6490, 'max_depth': 18, 'min_split_loss': 0.7271562952038193, 'min_child_weight': 3.887091545986012, 'max_delta_step': 6.807003622858407, 'subsample': 0.863875748084339, 'sampling_method': 'uniform', 'lambda': 0.3784014290804804, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 144}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:38:41,308] Trial 129 finished with value: 0.8780267278809883 and parameters: {'learning_rate': 0.14852389787897113, 'n_estimators': 7447, 'max_depth': 19, 'min_split_loss': 0.6810043547352789, 'min_child_weight': 3.3410328075532005, 'max_delta_step': 6.345545425626483, 'subsample': 0.9000869879211524, 'sampling_method': 'uniform', 'lambda': 1.0768894408362568, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 159}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:39:53,430] Trial 130 finished with value: 0.8911339351914892 and parameters: {'learning_rate': 0.1532921759234, 'n_estimators': 6943, 'max_depth': 18, 'min_split_loss': 1.6127677454706175, 'min_child_weight': 3.1475029758772863, 'max_delta_step': 7.72446785253366, 'subsample': 0.9026778233587713, 'sampling_method': 'uniform', 'lambda': 0.0032691245771460653, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 158}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:41:09,641] Trial 131 finished with value: 0.8838706677988432 and parameters: {'learning_rate': 0.19354765936359922, 'n_estimators': 7251, 'max_depth': 19, 'min_split_loss': 0.620550650891584, 'min_child_weight': 3.798619202599957, 'max_delta_step': 6.808482752310193, 'subsample': 0.9328843359855085, 'sampling_method': 'uniform', 'lambda': 0.969895720399609, 'grow_policy': 'lossguide', 'max_leaves': 20, 'max_bin': 145}. Best is trial 108 with value: 0.8774090434127533.
[I 2023-07-13 09:42:41,122] Trial 132 finished with value: 0.876295151416986 and parameters: {'learning_rate': 0.06081051648356832, 'n_estimators': 6671, 'max_depth': 19, 'min_split_loss': 0.7539971777999263, 'min_child_weight': 4.987377231026663, 'max_delta_step': 6.352391656372724, 'subsample': 0.869191881805553, 'sampling_method': 'uniform', 'lambda': 1.7402122812931264, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 142}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:45:51,319] Trial 133 finished with value: 0.9029344498570893 and parameters: {'learning_rate': 0.10724860491389103, 'n_estimators': 6808, 'max_depth': 18, 'min_split_loss': 0.02345151436580553, 'min_child_weight': 5.0590658582360195, 'max_delta_step': 6.2070837236269405, 'subsample': 0.9197326267822792, 'sampling_method': 'uniform', 'lambda': 1.7652674001625623, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 162}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:47:07,489] Trial 134 finished with value: 0.8869308636949181 and parameters: {'learning_rate': 0.2180736101224549, 'n_estimators': 6529, 'max_depth': 19, 'min_split_loss': 0.6337681360399735, 'min_child_weight': 5.674089958191898, 'max_delta_step': 6.388188711459793, 'subsample': 0.8674071154815993, 'sampling_method': 'uniform', 'lambda': 1.317941748666092, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 149}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:48:24,919] Trial 135 finished with value: 0.8950434055258597 and parameters: {'learning_rate': 0.05066521411333389, 'n_estimators': 7585, 'max_depth': 18, 'min_split_loss': 2.1283415556711875, 'min_child_weight': 3.3328203893331265, 'max_delta_step': 6.0347408495445025, 'subsample': 0.8887900734413322, 'sampling_method': 'uniform', 'lambda': 2.0226553974860297, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 142}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:49:51,405] Trial 136 finished with value: 0.8810273850972414 and parameters: {'learning_rate': 0.12729178175558742, 'n_estimators': 7148, 'max_depth': 17, 'min_split_loss': 0.8705524528352908, 'min_child_weight': 4.635999337074242, 'max_delta_step': 6.7349873451998, 'subsample': 0.8278197489617105, 'sampling_method': 'uniform', 'lambda': 1.6173196638317702, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 131}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:50:58,145] Trial 137 finished with value: 0.8825341758668908 and parameters: {'learning_rate': 0.16299315444062298, 'n_estimators': 6656, 'max_depth': 17, 'min_split_loss': 0.8816769008621278, 'min_child_weight': 4.675112904077707, 'max_delta_step': 6.755506221031457, 'subsample': 0.8985345302765978, 'sampling_method': 'uniform', 'lambda': 0.9197183556399815, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 131}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:52:11,797] Trial 138 finished with value: 0.8878348750449169 and parameters: {'learning_rate': 0.1409062571129513, 'n_estimators': 7263, 'max_depth': 16, 'min_split_loss': 1.7521605134409342, 'min_child_weight': 5.313892637433423, 'max_delta_step': 5.985987391613816, 'subsample': 0.866724996401968, 'sampling_method': 'uniform', 'lambda': 1.7633148741600435, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 156}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:54:57,100] Trial 139 finished with value: 0.9046628319284707 and parameters: {'learning_rate': 0.11918484202618146, 'n_estimators': 6402, 'max_depth': 17, 'min_split_loss': 1.578437198824409, 'min_child_weight': 7.246137425176588, 'max_delta_step': 6.270720710598658, 'subsample': 0.8313209514982116, 'sampling_method': 'gradient_based', 'lambda': 0.43068486298222286, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 143}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:56:14,451] Trial 140 finished with value: 0.8817620705601132 and parameters: {'learning_rate': 0.17854562305250365, 'n_estimators': 7150, 'max_depth': 19, 'min_split_loss': 0.7350022522422258, 'min_child_weight': 5.988541831451521, 'max_delta_step': 6.879670247611536, 'subsample': 0.9128948772296268, 'sampling_method': 'uniform', 'lambda': 1.1033272395902092, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 129}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 09:57:22,152] Trial 141 finished with value: 0.9144240262730637 and parameters: {'learning_rate': 0.06349308077974523, 'n_estimators': 7545, 'max_depth': 18, 'min_split_loss': 6.478948044540883, 'min_child_weight': 4.234235960921879, 'max_delta_step': 5.7586305940985945, 'subsample': 0.8382367606554902, 'sampling_method': 'uniform', 'lambda': 1.6223277519641928, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 136}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:00:21,399] Trial 142 finished with value: 0.9017325131583316 and parameters: {'learning_rate': 0.10164373366590787, 'n_estimators': 6748, 'max_depth': 18, 'min_split_loss': 0.001813089968630166, 'min_child_weight': 3.559818361882761, 'max_delta_step': 6.414215505158678, 'subsample': 0.8106601696339801, 'sampling_method': 'uniform', 'lambda': 2.2510094301163046, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 148}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:02:03,347] Trial 143 finished with value: 0.8793777805700177 and parameters: {'learning_rate': 0.041083336643909396, 'n_estimators': 7098, 'max_depth': 19, 'min_split_loss': 0.8190690960614299, 'min_child_weight': 4.935252063794117, 'max_delta_step': 6.833018320312307, 'subsample': 0.8688062344506597, 'sampling_method': 'uniform', 'lambda': 1.3553195622191938, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 132}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:03:24,055] Trial 144 finished with value: 0.8877230593677499 and parameters: {'learning_rate': 0.04887535146181505, 'n_estimators': 7754, 'max_depth': 19, 'min_split_loss': 1.4681657329135067, 'min_child_weight': 4.84309770440875, 'max_delta_step': 7.31014388629679, 'subsample': 0.8747999234634691, 'sampling_method': 'uniform', 'lambda': 0.8003189535554898, 'grow_policy': 'lossguide', 'max_leaves': 20, 'max_bin': 127}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:04:37,785] Trial 145 finished with value: 0.8812483319512665 and parameters: {'learning_rate': 0.12727211599772353, 'n_estimators': 7109, 'max_depth': 17, 'min_split_loss': 0.9418430494198606, 'min_child_weight': 6.3483190360507, 'max_delta_step': 6.839960284613035, 'subsample': 0.892246194968837, 'sampling_method': 'uniform', 'lambda': 1.2837284762691739, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 141}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:05:56,023] Trial 146 finished with value: 0.9205524627560079 and parameters: {'learning_rate': 0.08830686360989524, 'n_estimators': 7470, 'max_depth': 19, 'min_split_loss': 9.747038113072795, 'min_child_weight': 4.337179524129609, 'max_delta_step': 6.520757067677993, 'subsample': 0.854385401165792, 'sampling_method': 'uniform', 'lambda': 0.32764439641224957, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 167}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:07:04,271] Trial 147 finished with value: 0.9075219131339907 and parameters: {'learning_rate': 0.03585419622693202, 'n_estimators': 7080, 'max_depth': 17, 'min_split_loss': 2.624641490823327, 'min_child_weight': 5.155766403762799, 'max_delta_step': 7.222531387480347, 'subsample': 0.936921855550398, 'sampling_method': 'uniform', 'lambda': 2.0421459073289805, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 123}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:09:07,588] Trial 148 finished with value: 0.8830654376214009 and parameters: {'learning_rate': 0.07937758828200256, 'n_estimators': 6535, 'max_depth': 18, 'min_split_loss': 0.4507088387253651, 'min_child_weight': 3.9005909796645932, 'max_delta_step': 6.717776281410108, 'subsample': 0.8364591756165555, 'sampling_method': 'uniform', 'lambda': 0.021167027713988113, 'grow_policy': 'lossguide', 'max_leaves': 19, 'max_bin': 133}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:10:09,702] Trial 149 finished with value: 0.8931537497573749 and parameters: {'learning_rate': 0.0990812727096598, 'n_estimators': 6759, 'max_depth': 16, 'min_split_loss': 2.119424766451644, 'min_child_weight': 5.670698528312913, 'max_delta_step': 7.000126231194571, 'subsample': 0.8697794342002363, 'sampling_method': 'uniform', 'lambda': 1.4358668187193275, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 138}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:11:30,390] Trial 150 finished with value: 0.8788964684430194 and parameters: {'learning_rate': 0.05639569839809029, 'n_estimators': 6312, 'max_depth': 19, 'min_split_loss': 1.2226929132957105, 'min_child_weight': 4.625154914490137, 'max_delta_step': 7.48111205280043, 'subsample': 0.7896655583606267, 'sampling_method': 'uniform', 'lambda': 0.7908249605045063, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 152}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:13:05,226] Trial 151 finished with value: 0.8768627695649777 and parameters: {'learning_rate': 0.04214642079636691, 'n_estimators': 6301, 'max_depth': 19, 'min_split_loss': 1.112904819205483, 'min_child_weight': 4.603698180016465, 'max_delta_step': 7.483759093299602, 'subsample': 0.7799451907629953, 'sampling_method': 'uniform', 'lambda': 0.7639468881047967, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 151}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:14:26,115] Trial 152 finished with value: 0.8799695592341055 and parameters: {'learning_rate': 0.044788499565954945, 'n_estimators': 6219, 'max_depth': 19, 'min_split_loss': 1.2908871551762928, 'min_child_weight': 4.3979482108676535, 'max_delta_step': 7.592553180434437, 'subsample': 0.7929737334537201, 'sampling_method': 'uniform', 'lambda': 0.679021199893576, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 151}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:15:45,655] Trial 153 finished with value: 0.8811465096669873 and parameters: {'learning_rate': 0.047430580964086116, 'n_estimators': 6424, 'max_depth': 19, 'min_split_loss': 1.4195662280572243, 'min_child_weight': 3.985238590232259, 'max_delta_step': 7.595670830829958, 'subsample': 0.7874993766546703, 'sampling_method': 'uniform', 'lambda': 0.8133137701025916, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 153}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:17:48,178] Trial 154 finished with value: 0.8852998121878313 and parameters: {'learning_rate': 0.010998256274111315, 'n_estimators': 6303, 'max_depth': 19, 'min_split_loss': 1.235615166632235, 'min_child_weight': 3.012710813163719, 'max_delta_step': 7.399419527172078, 'subsample': 0.8031474496004906, 'sampling_method': 'uniform', 'lambda': 0.43053526229964145, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 163}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:20:10,387] Trial 155 finished with value: 0.8818519246371338 and parameters: {'learning_rate': 0.05897567091449628, 'n_estimators': 6027, 'max_depth': 19, 'min_split_loss': 0.3782790813883851, 'min_child_weight': 2.478330535460406, 'max_delta_step': 7.905855620189339, 'subsample': 0.7650663323243836, 'sampling_method': 'uniform', 'lambda': 0.9720890569464371, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 147}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:21:29,522] Trial 156 finished with value: 0.8880828586216056 and parameters: {'learning_rate': 0.022438886672149966, 'n_estimators': 5865, 'max_depth': 18, 'min_split_loss': 1.7258034443340051, 'min_child_weight': 4.994995952304208, 'max_delta_step': 7.486211658278147, 'subsample': 0.8089329568115116, 'sampling_method': 'uniform', 'lambda': 0.43562126435138615, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 151}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:22:27,065] Trial 157 finished with value: 0.9027695219104034 and parameters: {'learning_rate': 0.042743617483201844, 'n_estimators': 6147, 'max_depth': 18, 'min_split_loss': 3.3226527843842306, 'min_child_weight': 4.34360021827841, 'max_delta_step': 7.200591193094214, 'subsample': 0.8516863544274471, 'sampling_method': 'uniform', 'lambda': 1.1896921421533007, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 175}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:25:08,581] Trial 158 finished with value: 0.8963488134155376 and parameters: {'learning_rate': 0.03730302957162994, 'n_estimators': 6293, 'max_depth': 19, 'min_split_loss': 1.1110427845962734, 'min_child_weight': 3.48937482183573, 'max_delta_step': 7.812646991583511, 'subsample': 0.7463006524317697, 'sampling_method': 'gradient_based', 'lambda': 0.007370730104615964, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 144}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:26:21,775] Trial 159 finished with value: 0.907424450799231 and parameters: {'learning_rate': 0.0640622056981618, 'n_estimators': 7973, 'max_depth': 18, 'min_split_loss': 5.065869067091369, 'min_child_weight': 3.9249807795149594, 'max_delta_step': 7.504362519735831, 'subsample': 0.786525533232331, 'sampling_method': 'uniform', 'lambda': 5.605191499779153, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 158}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:29:34,537] Trial 160 finished with value: 0.8990051614974137 and parameters: {'learning_rate': 0.002279043008214056, 'n_estimators': 6576, 'max_depth': 20, 'min_split_loss': 0.6664773991243932, 'min_child_weight': 5.471425015191059, 'max_delta_step': 7.027489539732863, 'subsample': 0.5643111874637682, 'sampling_method': 'uniform', 'lambda': 0.7404656686939524, 'grow_policy': 'lossguide', 'max_leaves': 20, 'max_bin': 169}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:30:52,125] Trial 161 finished with value: 0.8812388858473937 and parameters: {'learning_rate': 0.08586094909884665, 'n_estimators': 5089, 'max_depth': 20, 'min_split_loss': 0.8841837290828923, 'min_child_weight': 4.512849604197466, 'max_delta_step': 7.662141224422161, 'subsample': 0.7717424772410283, 'sampling_method': 'uniform', 'lambda': 1.2270667646722866, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 124}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:33:03,304] Trial 162 finished with value: 0.885375741373428 and parameters: {'learning_rate': 0.0674868582848945, 'n_estimators': 5528, 'max_depth': 20, 'min_split_loss': 0.3516111309206132, 'min_child_weight': 4.994634343609818, 'max_delta_step': 7.211545942634844, 'subsample': 0.7791959068675147, 'sampling_method': 'uniform', 'lambda': 0.6480637563765622, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 138}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:34:33,104] Trial 163 finished with value: 0.8826001585824029 and parameters: {'learning_rate': 0.03468285660523529, 'n_estimators': 6866, 'max_depth': 19, 'min_split_loss': 1.356874047828189, 'min_child_weight': 4.555175330216208, 'max_delta_step': 7.999596295017982, 'subsample': 0.8173368028538293, 'sampling_method': 'uniform', 'lambda': 1.86478288722197, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 156}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:35:26,404] Trial 164 finished with value: 0.8871171353570697 and parameters: {'learning_rate': 0.10188988382025876, 'n_estimators': 4964, 'max_depth': 19, 'min_split_loss': 1.9803167535094954, 'min_child_weight': 3.7563152525085606, 'max_delta_step': 7.368098097782322, 'subsample': 0.7450025751650838, 'sampling_method': 'uniform', 'lambda': 2.397389668559303, 'grow_policy': 'lossguide', 'max_leaves': 16, 'max_bin': 115}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:36:05,818] Trial 165 finished with value: 0.9252530569729348 and parameters: {'learning_rate': 0.01981670462221717, 'n_estimators': 4427, 'max_depth': 20, 'min_split_loss': 12.470048056799792, 'min_child_weight': 4.212181449296891, 'max_delta_step': 6.894250516913689, 'subsample': 0.7962563285680467, 'sampling_method': 'uniform', 'lambda': 1.527584085814809, 'grow_policy': 'lossguide', 'max_leaves': 17, 'max_bin': 143}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:37:32,003] Trial 166 finished with value: 0.8783849255974214 and parameters: {'learning_rate': 0.07897643313215244, 'n_estimators': 6635, 'max_depth': 18, 'min_split_loss': 0.7902880508091105, 'min_child_weight': 3.2241378727132624, 'max_delta_step': 6.315850114056046, 'subsample': 0.8412408781839102, 'sampling_method': 'uniform', 'lambda': 0.3780240735181938, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 128}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:39:19,037] Trial 167 finished with value: 0.8775381980425545 and parameters: {'learning_rate': 0.056080470527929076, 'n_estimators': 6679, 'max_depth': 18, 'min_split_loss': 0.4496487101625447, 'min_child_weight': 3.0402032875272242, 'max_delta_step': 6.360010100369441, 'subsample': 0.8879269747387457, 'sampling_method': 'uniform', 'lambda': 0.408656447914132, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 134}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:41:13,083] Trial 168 finished with value: 0.8776622926673611 and parameters: {'learning_rate': 0.04886696539328021, 'n_estimators': 6629, 'max_depth': 17, 'min_split_loss': 0.36096751495059687, 'min_child_weight': 2.1443668562857576, 'max_delta_step': 6.173422768451604, 'subsample': 0.9071635481374991, 'sampling_method': 'uniform', 'lambda': 0.9046203566205953, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 132}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:42:51,541] Trial 169 finished with value: 0.8791949363250563 and parameters: {'learning_rate': 0.05701027489817309, 'n_estimators': 6963, 'max_depth': 18, 'min_split_loss': 0.28880239546532815, 'min_child_weight': 2.703168900203443, 'max_delta_step': 6.34209282199766, 'subsample': 0.9518756285592721, 'sampling_method': 'uniform', 'lambda': 0.3077262211389721, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 121}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:44:54,549] Trial 170 finished with value: 0.8774215188034745 and parameters: {'learning_rate': 0.05389622419501096, 'n_estimators': 6970, 'max_depth': 18, 'min_split_loss': 0.2720876344265821, 'min_child_weight': 1.911518358201508, 'max_delta_step': 5.602535513084254, 'subsample': 0.9236116045316549, 'sampling_method': 'uniform', 'lambda': 0.4366584132557082, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 135}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:47:40,908] Trial 171 finished with value: 0.8798551299829516 and parameters: {'learning_rate': 0.05573662332125569, 'n_estimators': 6962, 'max_depth': 18, 'min_split_loss': 0.007308314802298432, 'min_child_weight': 1.9466333317681903, 'max_delta_step': 5.928069913649758, 'subsample': 0.9567065116943596, 'sampling_method': 'uniform', 'lambda': 1.1098204236065672, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 135}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:49:14,782] Trial 172 finished with value: 0.8790684861269904 and parameters: {'learning_rate': 0.05560503541559699, 'n_estimators': 6958, 'max_depth': 18, 'min_split_loss': 0.29182910339218293, 'min_child_weight': 2.1756670235649125, 'max_delta_step': 5.996620694073155, 'subsample': 0.9599689169851942, 'sampling_method': 'uniform', 'lambda': 1.2528310634374245, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 135}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:50:41,140] Trial 173 finished with value: 0.9152196380767668 and parameters: {'learning_rate': 0.07167492103597176, 'n_estimators': 6654, 'max_depth': 18, 'min_split_loss': 0.33244030581881145, 'min_child_weight': 2.1113278498287764, 'max_delta_step': 5.633044959396494, 'subsample': 0.9775703729660943, 'sampling_method': 'uniform', 'lambda': 0.36800196954250075, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 15}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:53:33,697] Trial 174 finished with value: 0.8815516078418272 and parameters: {'learning_rate': 0.05800422941654915, 'n_estimators': 7330, 'max_depth': 17, 'min_split_loss': 0.018846883910099144, 'min_child_weight': 1.495072962266362, 'max_delta_step': 6.233841383175889, 'subsample': 0.9547694864221636, 'sampling_method': 'uniform', 'lambda': 1.2351848044512554, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 119}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:55:05,884] Trial 175 finished with value: 0.8790986868401637 and parameters: {'learning_rate': 0.08118580865126829, 'n_estimators': 7000, 'max_depth': 18, 'min_split_loss': 0.4595772121818681, 'min_child_weight': 2.2833651071829197, 'max_delta_step': 6.351205862113404, 'subsample': 0.923069061871744, 'sampling_method': 'uniform', 'lambda': 8.737969801937709, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 127}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:56:40,840] Trial 176 finished with value: 0.87793018764916 and parameters: {'learning_rate': 0.080815605635046, 'n_estimators': 6987, 'max_depth': 18, 'min_split_loss': 0.42345023109997737, 'min_child_weight': 2.271539434970154, 'max_delta_step': 6.380315764663932, 'subsample': 0.9251031610052981, 'sampling_method': 'uniform', 'lambda': 9.490068457173328, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 128}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 10:59:42,754] Trial 177 finished with value: 0.8983568462878104 and parameters: {'learning_rate': 0.08557082126031534, 'n_estimators': 6970, 'max_depth': 18, 'min_split_loss': 0.47684516492300033, 'min_child_weight': 2.531906408332266, 'max_delta_step': 6.334510299824475, 'subsample': 0.926199890559424, 'sampling_method': 'gradient_based', 'lambda': 9.071169199858272, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 126}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:01:21,200] Trial 178 finished with value: 0.8781383142783519 and parameters: {'learning_rate': 0.11319964805257607, 'n_estimators': 6742, 'max_depth': 18, 'min_split_loss': 0.3718582122157912, 'min_child_weight': 2.133704613397105, 'max_delta_step': 6.130290283362323, 'subsample': 0.9170602034196845, 'sampling_method': 'uniform', 'lambda': 10.388426035816108, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 136}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:03:54,653] Trial 179 finished with value: 0.8919026816717542 and parameters: {'learning_rate': 0.11801032487928224, 'n_estimators': 6734, 'max_depth': 18, 'min_split_loss': 0.013297706781160934, 'min_child_weight': 1.7602134827263647, 'max_delta_step': 5.6241349603860575, 'subsample': 0.9098592229988208, 'sampling_method': 'uniform', 'lambda': 10.366760247670369, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 139}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:05:09,665] Trial 180 finished with value: 0.884039760558635 and parameters: {'learning_rate': 0.10373276153877208, 'n_estimators': 6903, 'max_depth': 18, 'min_split_loss': 0.3818621983239968, 'min_child_weight': 2.2532652224163447, 'max_delta_step': 6.110901013939228, 'subsample': 0.9688337071964364, 'sampling_method': 'uniform', 'lambda': 11.029653180192387, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 119}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:06:21,781] Trial 181 finished with value: 0.8999356669821991 and parameters: {'learning_rate': 0.5085081189899369, 'n_estimators': 7014, 'max_depth': 19, 'min_split_loss': 0.45965470308746254, 'min_child_weight': 1.0729363736073054, 'max_delta_step': 5.865137382044641, 'subsample': 0.932798038542828, 'sampling_method': 'uniform', 'lambda': 9.837212558417594, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 130}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:07:42,811] Trial 182 finished with value: 0.895115384668056 and parameters: {'learning_rate': 0.03685106828475071, 'n_estimators': 7390, 'max_depth': 19, 'min_split_loss': 1.0434286321199557, 'min_child_weight': 2.7486882088389004, 'max_delta_step': 6.194114119607229, 'subsample': 0.945232919301992, 'sampling_method': 'uniform', 'lambda': 9.18915883348942, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 135}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:08:59,221] Trial 183 finished with value: 0.8809778048526932 and parameters: {'learning_rate': 0.08594038343441283, 'n_estimators': 6661, 'max_depth': 18, 'min_split_loss': 0.6738239540512259, 'min_child_weight': 2.2191866053585403, 'max_delta_step': 6.433536196285236, 'subsample': 0.9173052420923888, 'sampling_method': 'uniform', 'lambda': 6.819855460246533, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 128}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:11:56,416] Trial 184 finished with value: 0.8819652663501794 and parameters: {'learning_rate': 0.07553465623425669, 'n_estimators': 7187, 'max_depth': 18, 'min_split_loss': 0.018273741139265776, 'min_child_weight': 1.5701036137711075, 'max_delta_step': 6.100585573084444, 'subsample': 0.9824869469711538, 'sampling_method': 'uniform', 'lambda': 10.039915464502545, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 122}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:13:03,477] Trial 185 finished with value: 0.9247981095372731 and parameters: {'learning_rate': 0.04178857547413414, 'n_estimators': 6814, 'max_depth': 17, 'min_split_loss': 8.70177245604453, 'min_child_weight': 2.6780291416921336, 'max_delta_step': 6.511645240503645, 'subsample': 0.9010155250271862, 'sampling_method': 'uniform', 'lambda': 8.373990761968079, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 137}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:14:08,490] Trial 186 finished with value: 0.8938053126774586 and parameters: {'learning_rate': 0.11189897881792155, 'n_estimators': 6409, 'max_depth': 18, 'min_split_loss': 1.264895337050946, 'min_child_weight': 0.8893408078808562, 'max_delta_step': 6.278261329321239, 'subsample': 0.9325543897887675, 'sampling_method': 'uniform', 'lambda': 12.92861423513899, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 133}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:16:05,045] Trial 187 finished with value: 0.8765799460551337 and parameters: {'learning_rate': 0.05853236639735816, 'n_estimators': 7032, 'max_depth': 19, 'min_split_loss': 0.47940347153846585, 'min_child_weight': 2.067956084992854, 'max_delta_step': 5.855024626745174, 'subsample': 0.8865310142918622, 'sampling_method': 'uniform', 'lambda': 10.823618556418722, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 142}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:18:26,598] Trial 188 finished with value: 0.8811945439282024 and parameters: {'learning_rate': 0.016108271398920314, 'n_estimators': 6612, 'max_depth': 17, 'min_split_loss': 0.5027558353446157, 'min_child_weight': 1.9507654831404242, 'max_delta_step': 5.469549644971009, 'subsample': 0.8912376280447862, 'sampling_method': 'uniform', 'lambda': 8.614288537852364, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 145}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:19:33,928] Trial 189 finished with value: 0.8977580792887065 and parameters: {'learning_rate': 0.31906642592913065, 'n_estimators': 6809, 'max_depth': 18, 'min_split_loss': 1.551188550228617, 'min_child_weight': 1.5169425919296569, 'max_delta_step': 5.908442224434225, 'subsample': 0.9515144102732135, 'sampling_method': 'uniform', 'lambda': 7.793547714634867, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 140}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:22:59,582] Trial 190 finished with value: 0.896870723844599 and parameters: {'learning_rate': 0.05931562340953149, 'n_estimators': 7732, 'max_depth': 17, 'min_split_loss': 0.36915359104093504, 'min_child_weight': 3.0335116803739712, 'max_delta_step': 6.0784135828075065, 'subsample': 0.9210454659022806, 'sampling_method': 'gradient_based', 'lambda': 10.596601759197215, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 127}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:24:05,868] Trial 191 finished with value: 0.9048852402429226 and parameters: {'learning_rate': 0.08390190320943379, 'n_estimators': 7046, 'max_depth': 19, 'min_split_loss': 0.9553964409754248, 'min_child_weight': 2.3870898971207093, 'max_delta_step': 6.332424408396136, 'subsample': 0.9967700086842564, 'sampling_method': 'uniform', 'lambda': 10.950056910391408, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 133}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:25:57,752] Trial 192 finished with value: 0.8781291951629931 and parameters: {'learning_rate': 0.03442478666004274, 'n_estimators': 7291, 'max_depth': 19, 'min_split_loss': 0.6892069172747617, 'min_child_weight': 1.9692854051797934, 'max_delta_step': 5.7972459835666035, 'subsample': 0.8857541737180094, 'sampling_method': 'uniform', 'lambda': 9.393928346507504, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 148}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:28:06,852] Trial 193 finished with value: 0.8771187392707207 and parameters: {'learning_rate': 0.06720536146081521, 'n_estimators': 7288, 'max_depth': 19, 'min_split_loss': 0.3834352624004022, 'min_child_weight': 2.0135303479502813, 'max_delta_step': 5.836852799127091, 'subsample': 0.888464312042788, 'sampling_method': 'uniform', 'lambda': 11.424023406098007, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 147}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:31:03,751] Trial 194 finished with value: 0.9334388756164586 and parameters: {'learning_rate': 0.2773685331082679, 'n_estimators': 7420, 'max_depth': 19, 'min_split_loss': 0.013933748284196412, 'min_child_weight': 1.950427140506327, 'max_delta_step': 5.829977316974377, 'subsample': 0.9074575595704523, 'sampling_method': 'uniform', 'lambda': 10.03735756747258, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 148}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:32:34,786] Trial 195 finished with value: 0.8776727711454784 and parameters: {'learning_rate': 0.09970132331982376, 'n_estimators': 7276, 'max_depth': 19, 'min_split_loss': 0.587558114436188, 'min_child_weight': 2.345834881418715, 'max_delta_step': 5.696146572090322, 'subsample': 0.8876730813072058, 'sampling_method': 'uniform', 'lambda': 11.423881499621348, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 153}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:34:09,272] Trial 196 finished with value: 0.8768635591851479 and parameters: {'learning_rate': 0.09725752649443446, 'n_estimators': 7553, 'max_depth': 19, 'min_split_loss': 0.6197729019638455, 'min_child_weight': 1.4260976333937094, 'max_delta_step': 5.673379572881096, 'subsample': 0.8877757920109466, 'sampling_method': 'uniform', 'lambda': 11.489634078017199, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 161}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:35:23,594] Trial 197 finished with value: 0.885027511360341 and parameters: {'learning_rate': 0.12628583318344772, 'n_estimators': 7551, 'max_depth': 19, 'min_split_loss': 1.1878750647831233, 'min_child_weight': 1.2105612263672527, 'max_delta_step': 5.4396592591827355, 'subsample': 0.8874130967254702, 'sampling_method': 'uniform', 'lambda': 11.62176397211094, 'grow_policy': 'lossguide', 'max_leaves': 13, 'max_bin': 160}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:36:49,387] Trial 198 finished with value: 0.8777471777803451 and parameters: {'learning_rate': 0.10228792921014172, 'n_estimators': 7190, 'max_depth': 20, 'min_split_loss': 0.6806295502063332, 'min_child_weight': 0.47786672378170914, 'max_delta_step': 5.749097358000785, 'subsample': 0.8853443021825343, 'sampling_method': 'uniform', 'lambda': 12.065524719228227, 'grow_policy': 'lossguide', 'max_leaves': 14, 'max_bin': 155}. Best is trial 132 with value: 0.876295151416986.
[I 2023-07-13 11:38:08,995] Trial 199 finished with value: 0.8795722549502252 and parameters: {'learning_rate': 0.14914079084126147, 'n_estimators': 7297, 'max_depth': 20, 'min_split_loss': 0.7893771957304595, 'min_child_weight': 0.5063525274445828, 'max_delta_step': 5.703261287880724, 'subsample': 0.8843030997453167, 'sampling_method': 'uniform', 'lambda': 11.509477146803032, 'grow_policy': 'lossguide', 'max_leaves': 15, 'max_bin': 154}. Best is trial 132 with value: 0.876295151416986.
Number of finished trials: 200
Best trial: {'learning_rate': 0.06081051648356832, 'n_estimators': 6671, 'max_depth': 19, 'min_split_loss': 0.7539971777999263, 'min_child_weight': 4.987377231026663, 'max_delta_step': 6.352391656372724, 'subsample': 0.869191881805553, 'sampling_method': 'uniform', 'lambda': 1.7402122812931264, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 142}
params = {'learning_rate': 0.06081051648356832, 'n_estimators': 6671, 'max_depth': 19, 'min_split_loss': 0.7539971777999263, 'min_child_weight': 4.987377231026663, 'max_delta_step': 6.352391656372724, 'subsample': 0.869191881805553, 'sampling_method': 'uniform', 'lambda': 1.7402122812931264, 'grow_policy': 'lossguide', 'max_leaves': 18, 'max_bin': 142}
model = XGBRegressor(**params, random_state=42, n_jobs=-1, tree_method='gpu_hist')
model.fit(X_scaled, y)
XGBRegressor(base_score=None, booster=None, callbacks=None,
colsample_bylevel=None, colsample_bynode=None,
colsample_bytree=None, early_stopping_rounds=None,
enable_categorical=False, eval_metric=None, feature_types=None,
gamma=None, gpu_id=None, grow_policy='lossguide',
importance_type=None, interaction_constraints=None,
lambda=1.7402122812931264, learning_rate=0.06081051648356832,
max_bin=142, max_cat_threshold=None, max_cat_to_onehot=None,
max_delta_step=6.352391656372724, max_depth=19, max_leaves=18,
min_child_weight=4.987377231026663,
min_split_loss=0.7539971777999263, missing=nan,
monotone_constraints=None, n_estimators=6671, n_jobs=-1,
num_parallel_tree=None, ...)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. XGBRegressor(base_score=None, booster=None, callbacks=None,
colsample_bylevel=None, colsample_bynode=None,
colsample_bytree=None, early_stopping_rounds=None,
enable_categorical=False, eval_metric=None, feature_types=None,
gamma=None, gpu_id=None, grow_policy='lossguide',
importance_type=None, interaction_constraints=None,
lambda=1.7402122812931264, learning_rate=0.06081051648356832,
max_bin=142, max_cat_threshold=None, max_cat_to_onehot=None,
max_delta_step=6.352391656372724, max_depth=19, max_leaves=18,
min_child_weight=4.987377231026663,
min_split_loss=0.7539971777999263, missing=nan,
monotone_constraints=None, n_estimators=6671, n_jobs=-1,
num_parallel_tree=None, ...)X_test = df_test.copy()
y_test = X_test.pop('Giá')
X_test.drop(['Ngày', 'Giá/m2', 'Đơn vị tính'], axis=1, inplace=True)
X_ordinal_test = X_test.copy()
for col in categorical_cols:
X_ordinal_test[col] = X_ordinal_test[col].cat.codes
X_scaled_test = pd.DataFrame(scaler.transform(X_ordinal_test))
X_scaled_test.columns = X_ordinal_test.columns.astype(str)
y_pred = model.predict(X_scaled_test)
print('RMSE score:', mean_squared_error(y_test, y_pred, squared=False))
print('MAE score:', mean_absolute_error(y_test, y_pred))
RMSE score: 73.46327431674595 MAE score: 3.035027986746591
df_pred = pd.DataFrame({
'y_pred': y_pred,
'y_test': y_test,
'error': abs(y_pred - y_test)
})
df_pred.head()
| y_pred | y_test | error | |
|---|---|---|---|
| 22213 | 5.403500080 | 8.999760000 | 3.596259920 |
| 55014 | 3.664644480 | 5.200000000 | 1.535355520 |
| 52852 | 4.333394527 | 4.500230000 | 0.166835473 |
| 81138 | 5.083576202 | 5.499900000 | 0.416323798 |
| 50661 | 0.990600646 | 1.410000000 | 0.419399354 |
plt.figure(figsize=(12, 8))
sns.scatterplot(data=df_pred, x='y_test', y='y_pred', alpha=0.7, color='#F38181')
plt.title('Giá nhà thực tế và giá nhà dự đoán')
plt.xlabel('Giá nhà thực tế (tỷ VND)')
plt.ylabel('Giá nhà dự đoán (tỷ VND)')
plt.show()
Nhận xét: tập test có một vài outlier mô hình không dự đoán được giá
df_pred.sort_values(by='error', ascending=False).head(10)
| y_pred | y_test | error | |
|---|---|---|---|
| 23803 | 5.556128502 | 6200.000000000 | 6194.443871498 |
| 51823 | 4.289775372 | 4448.000000000 | 4443.710224628 |
| 1574 | 5.644052029 | 3649.998860000 | 3644.354807971 |
| 73597 | 3.976968527 | 3099.999969000 | 3096.023000473 |
| 1583 | 5.265932083 | 2649.998520000 | 2644.732587917 |
| 82116 | 4.010414124 | 309.997800000 | 305.987385876 |
| 14827 | 4.195895195 | 310.000500000 | 305.804604805 |
| 16393 | 3.832955360 | 299.999999988 | 296.167044628 |
| 63827 | 2.945009708 | 239.998500000 | 237.053490292 |
| 12489 | 4.425043583 | 229.999999968 | 225.574956385 |
iqr = df_pred['y_test'].quantile(0.75) - df_pred['y_test'].quantile(0.25)
upper_bound = df_pred['y_test'].quantile(0.75) + 1.5 * iqr
lower_bound = df_pred['y_test'].quantile(0.25) - 1.5 * iqr
df_pred_no_outlier = df_pred[(df_pred['y_test'] < upper_bound) & (df_pred['y_test'] > lower_bound)]
lim = (-0.2, 9.2)
plt.figure(figsize=(12, 8))
sns.scatterplot(data=df_pred_no_outlier, x='y_test', y='y_pred', alpha=0.5, color='#F38181')
plt.xlim(*lim)
plt.ylim(*lim)
plt.plot(lim, lim, color='red', linestyle='--')
plt.title('Giá nhà thực tế và giá nhà dự đoán')
plt.xlabel('Giá nhà thực tế (tỷ VND)')
plt.ylabel('Giá nhà dự đoán (tỷ VND)')
plt.show()
def plot_pred_actual(col, col_wrap=4):
lim = (-0.2, 9.2)
g = sns.relplot(data=df_pred_no_outlier, x='y_test', y='y_pred', alpha=0.7, color='#F38181', col=X_test[col], kind='scatter', col_wrap=col_wrap)
for ax in g.axes.flat:
ax.set_xlim(*lim)
ax.set_ylim(*lim)
ax.plot(lim, lim, color='red', linestyle='--')
g.fig.suptitle(f'Giá nhà thực tế và giá nhà dự đoán theo {col}', y=1.05)
g.set_axis_labels('Giá nhà thực tế (tỷ VND)', 'Giá nhà dự đoán (tỷ VND)')
plt.show()
plot_pred_actual('Loại hình nhà ở')
plot_pred_actual('Nội thành', col_wrap=2)
plot_pred_actual('Số tầng')
plot_pred_actual('Số phòng ngủ')
plot_pred_actual('Năm')
plot_pred_actual('Tháng')